Can't build Android app when including AppCompat library

I suddenly cannot build my Android app when including the AppCompat library, which is basically required in all Android apps now.

E: aapt: Found tag id where item is expected [/../EBuild/Obj/.../Cooper-Android/aar/savedstate-1.1.0/res/values/values.xml (3)]
E: aapt: Found tag id where item is expected [/../EBuild/Obj/.../Cooper-Android/aar/lifecycle-viewmodel-2.3.0/res/values/values.xml (3)]
E: aapt: Found tag id where item is expected [/../EBuild/Obj/.../Cooper-Android/aar/lifecycle-runtime-2.3.0/res/values/values.xml (3)]

The contents of the problematic values.xml file:

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

It looks like appcompat has unbounded dependencies on savedstate, lifecycle-viewmodel, and lifecycle-runtime, all of which recently updated to include this problematic values.xml file. The file is not included in previous versions of these dependencies, so there was no error previously.

Sample project:
org.gradletest.zip (1.4 MB)

define “suddenly”?

That sounds like broken XML files?

Ok. if this xml files come form external dependencies, and they are bad that appt (which isn’t our tool) cant handle then, I’m not sure what I can do about it? — either apt is broken, or those packages? Maybe they require using aapt2?

It was building yesterday morning but not yesterday afternoon. After seeing the issue, I assume that something caused me to re-resolve references, which pulled in the new and problematic dependency.

Interesting, so these errors come straight from aapt? I’m not having any issues with it in Android Studio. Could it be that aapt intends them as warnings that Android Studio ignores but EBuild interprets them as errors?

Possibly, as I’m using aapt2 in Android Studio. Hopefully that’s not it as I’m under a time crunch and don’t have time to get aapt2 working in EBuild before being able to build again.

I found the same issue reported on a Xamarin thread and the solution was to move to aapt2. Sigh…

Build be, yeah. can you manually run the aapt command in Terminal and send me the unprocessed output? detecting errors from the android tools is more art (or black magic) then science, as they ar every inconsistent; maybe I’m interpreting something wrong…

:(.

I can still look at maybe not treating these as errors — but who knows if that helps or just delayed the problem to runtime…

1 Like

Certainly looks to be an error.

Configurations:
 (default)

Files:
  values/values.xml
    Src: () /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/drawerlayout-1.1.1/res/values/values.xml
  AndroidManifest.xml
    Src: () /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/AndroidManifest.xml

Resource Dirs:
  Type values
    values/values.xml
      Src: () /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/drawerlayout-1.1.1/res/values/values.xml
Including resources from package: /Users/mattr/Library/Android/sdk/platforms/android-29/android.jar
applyFileOverlay for drawable
trying overlaySet Key=abc_vector_test.xml

...
...

trying overlaySet Key=abc_tint_edittext.xml
trying overlaySet Key=abc_tint_seek_thumb.xml
trying overlaySet Key=abc_tint_spinner.xml
trying overlaySet Key=abc_tint_switch_track.xml
trying overlaySet Key=switch_thumb_material_dark.xml
trying overlaySet Key=switch_thumb_material_light.xml
applyFileOverlay for menu
applyFileOverlay for font
applyFileOverlay for mipmap
Processing image: /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/drawable-mdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png
Processing image: /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/drawable-xhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png
Processing image: /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/drawable-hdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png
Processing image: /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/drawable-xxhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png
    (processed image /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/drawable-mdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png: 253% size of source)

...
...

    (new resource id abc_tint_switch_track from /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/color/abc_tint_switch_track.xml)
    (new resource id abc_tint_switch_track from /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/color-v23/abc_tint_switch_track.xml)
    (new resource id switch_thumb_material_dark from /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/color/switch_thumb_material_dark.xml)
    (new resource id switch_thumb_material_light from /Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/appcompat-1.2.0/res/color/switch_thumb_material_light.xml)
/Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/savedstate-1.1.0/res/values/values.xml:3: error: Found tag id where item is expected

/Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/lifecycle-viewmodel-2.3.0/res/values/values.xml:3: error: Found tag id where item is expected

/Users/mattr/Library/Application Support/RemObjects Software/EBuild/Obj/org.gradletest-3D6480681C20545BA18D88CF7E85BCC8BBA0DE31/Debug/Cooper-Android/aar/lifecycle-runtime-2.3.0/res/values/values.xml:3: error: Found tag id where item is expected

1 Like