'Android resource compilation failed in v3.2

So I updated my Android Studio to v3.2. When I tried compiling the project, build fails. Below is the error:

Android resource compilation failed
    Output:  C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:900: error: <item> inner element must either be a resource reference or empty.

    Command: C:\Users\Ashish\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\7f1fbe9171e916e5044000cd76b749c8\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
            -o \
            C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\res\merged\debug \
            C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
    Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

Please do tell if there is any more information required. Any help will be appreciated.



Solution 1:[1]

the <item> in values.xml at line 900 ...might be of resource-type id.

the correct syntax would be (just as the error message tells):

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

see the documentation.

Solution 2:[2]

For me I had the layout width and layout height in the layout view and the LinearLayout view for databinding. This threw a duplicate error.

I fixed this by removing the layout_width and layout_height attributes in <layout>.

Solution 3:[3]

I'm just finishing this issue a few minutes ago, try to modify or delete id.xml, if you think you don't have it, try to find in another module in your app. I change my value resource from <item name="header_view" type="id">header_view</item> to <item name="header_view" type="id"/> and it worked for me.

Solution 4:[4]

just change your attr name which is present in resource -> values -> attr

<attr name="fontFamilys">
    <enum name="roboto" value="0" />
    <enum name="roboto_condensed" value="1" />
    <enum name="roboto_slab" value="2" />
</attr>

for example if you are getting error related to fontFamily just change the the name build the application error will not come

Solution 5:[5]

i also meet the problem,you just need to find where the values in,and update it from <item type="id" name="id_name" >id_name</item> to <item type="id" name="id_name" />,now it's ok.

Solution 6:[6]

I got that problem when I'd quotation within <string> tag

    <string name="vj_dialogue">I'm waiting</string>

when I escaped it with backslash '' . The problem was gone

    <string name="vj_dialogue">I\'m waiting</string>

Solution 7:[7]

in your build gradle(Project:name) do it like that

classpath 'com.android.tools.build:gradle:3.+'

then rebuild your project .. after that it will show message to update your gradle from 4.6 to 4.10

Solution 8:[8]

In my case

<?xml version="1.0" encoding="utf-8"?>

is repeated twice in the XML. Make sure it should be one per a file at the top of the XML.

Solution 9:[9]

This is what worked for me:

In my build.gradle file > dependencies, I was implementing a newer version of appcompat library

dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'com.android.support:support-v4:21.0.3'
   implementation 'com.android.support:appcompat-v7:21.0.3'
   implementation 'androidx.appcompat:appcompat:1.0.2'}

After commenting //implementation 'androidx.appcompat:appcompat:1.0.2' It worked fine. I would suggest, even if it's a different library, Please check the version you are using.

Solution 10:[10]

This could also happen if you mistakenly happened to not escape some value (apostrophe with backslash or ampersand with & or something else I am not aware of) under res/values/strings.xml file

to bring it in context here is an example ->

incorrect :

<string name="update_now">Let's Update now</string>

correct :

<string name="update_now">Let\'s Update now</string>

Solution 11:[11]

In your xml file, you may forget to add /> to brace your attribute.

Solution 12:[12]

JKS is machine independent and can be transferred to different machines/servers