I decided to upgrade Android Studio today against my own better judgment. After upgrading, building the project failed due to
Android resource compilation failed
Output: /home/username/AndroidStudioProjects/project/mobile/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:841: error: <item> inner element must either be a resource reference or empty.
Line 841 was an <item>
.
So I removed all the <item>
bodies in values.xml
like so:
<item name="item_1" type="id">Item 1</item>
to
<item name="item_1" type="id"/>
This did not fix the problem, as the same error is being thrown. The traceback now refers to a <string>
resource in my values.xml
file. There are no <item>
s in the file that aren't fixed, so now I'm stuck. I've also tried the usual invalidate caches & restart
, sync with Gradle files
, clean
and build
stuff to no avail.
Edit:
I quickly noticed that upon building the project, line 841 (from the first traceback) is dynamically changed to the old <item>
style, thus throwing the Exception. The source code XML file is free of the bodies, but the build-generated XML file generates it with a body in the item elements.
Removing the body from these tags does nothing, as the body is re-added on runtime every single time.