Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android resource compilation failed in v3.2

Tags:

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.

like image 307
Ashish Yadav Avatar asked Sep 25 '18 17:09

Ashish Yadav


2 Answers

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

like image 60
Gabriel Rohden Avatar answered Oct 19 '22 09:10

Gabriel Rohden


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.

like image 25
Martin Zeitler Avatar answered Oct 19 '22 07:10

Martin Zeitler