Android resource compilation failed in v3.2

China☆狼群 提交于 2019-11-29 01:21:22

I was facing this issue today after updating gradle from 3.1.4 to 3.2.0. I don't know why, but the build started to throw that exception. i deleted the build folder, and deleted the gradle caches folder but nothing worked, so i looked at the merged values.xml and turns out that my ids.xml was defining a wrong id that was being merged to the values.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="downloading_package" type="id">Baixando pacote de sincronização</item>
</resources>

And apparently this was working before the update... for my case i deleted the ids.xml file (it was useless in the project)

I wish i could know why before the update everything was working

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.

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.

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.

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

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!