Android resource compilation failed in 3.3.0-alpha02

后端 未结 4 772
南旧
南旧 2021-01-05 18:09

Whenever I try and build my project, I get this error:

Android resource compilation failed
Output:  
C:\\Users\\smart\\AndroidStudioProjects\\ShoppingList\\a         


        
相关标签:
4条回答
  • 2021-01-05 18:30

    I got something similar where the Android resource compilation failed.

    error: <item> inner element must either be a resource reference or empty.
    

    I'm seeing some posts that suggest deleting a "ids.xml" file and that fixes the issue. While that may fix it, you may be doing more harm since code may refer to that id tag.

    I fixed my issue by updating the "ids.xml" file from:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <item name="item_click_support" type="id">id</item>
    </resources>
    

    To:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <item name="item_click_support" type="id"/>
    </resources>
    

    Notice how the Item tag is a self closing xml element now. This is the correct way to list id's within the "ids.xml" file now. You can refer to the official Android documentation for this as well.

    Cheers!

    0 讨论(0)
  • 2021-01-05 18:33

    I don't konw why but this work for my project. such as the problem,i get seam error just like your. i fix them like this:i search error location

    Android resource compilation failed
    Output:  F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1703: error: duplicate value for resource 'attr/progress' with config ''.
    F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1703: error: resource previously defined here.
    
    Command: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\802c7c840816e44cd175d342954a2954\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
            -o \
            F:\Works\AndroidProject\lbw\app\build\intermediates\res\merged\debug \
            F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
    Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

    then i search the file

    F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
    

    and i find the location at lines 1703 enter image description here

    and i find the error location in the file enter image description here

    and i copy the name absProgressBar search in attrs then i get the error location enter image description here

    than i commenty <!-- <attr name="progress" format="integer" />--> build argen the error will be gone.

    0 讨论(0)
  • 2021-01-05 18:35

    why not to change your gradle plugin version?

    First: finding how many local gradle available by looking your gradle file, 'file'->'setting'->'Build, Execuion, Deployment'->'Gradle',then you will find this file which contain a file named 'wrapper\dists', open it and you will see them.

    Second: Edit file named 'gradle-wrapper.properties', and change distributionUrl's value to a version which is included in your local gradle group.

    Last: change the classpath in your build.gradle ,there is a link your can get help from it.

    help you'll understand my poor English, so that i can help you:)

    0 讨论(0)
  • 2021-01-05 18:36

    When i upgrade android studio this error "Android resource compilation failed" occurred.

    I search every there, but i cant find solution so i deleted three line in values.xml

    <item type="id" name="id_name" />
    <item name="omfm_main_label_id" type="id">OMFMLabelId</item>
    <item name="omfm_tag" type="id">OMFMTag</item> 
    

    so it worked . notice : all library in build.gradle must be upgraded.

    0 讨论(0)
提交回复
热议问题