Status Update
Comments
gh...@google.com <gh...@google.com>
je...@google.com <je...@google.com>
ku...@gmail.com <ku...@gmail.com> #2
I have been able to reproduce the exception in a demo project here:
One slight difference is that the build will still succeed in this demo, but it will log the above IllegalArgumentException
to console and continue building successfully. Still not sure what is the difference in that it is causing the Task to actually fail for our production app.
Please let me know if I can provide anything else.
ga...@google.com <ga...@google.com> #3
Version: AGP 7.4.0-alpha09
Using the attached project and running:
gw :app:merRelRes
- modify
app/src/main/res/layout/used18.xml
by e.g adding a comment gw :app:merRelRes
fails with
Caused by: java.lang.IllegalArgumentException: Unable to locate resourceFile (/usr/local/google/home/gavra/AndroidStudioProjects/MyApplication36/app/build/intermediates/merged-not-compiled-resources/release/layout/notification_action.xml) in source-sets.
at com.android.ide.common.resources.RelativeResourceUtils.getRelativeSourceSetPath(RelativeResourceUtils.kt:47)
at com.android.ide.common.resources.MergedResourceWriter.getSourceFilePath(MergedResourceWriter.java:334)
at com.android.ide.common.resources.MergedResourceWriter.removeOutFile(MergedResourceWriter.java:769)
at com.android.ide.common.resources.MergedResourceWriter.removeFileFromNotCompiledOutputDir(MergedResourceWriter.java:737)
at com.android.ide.common.resources.MergedResourceWriter.removeOutFile(MergedResourceWriter.java:755)
at com.android.ide.common.resources.MergedResourceWriter.removeItem(MergedResourceWriter.java:449)
at com.android.ide.common.resources.MergedResourceWriter.removeItem(MergedResourceWriter.java:72)
at com.android.ide.common.resources.DataMerger.mergeData(DataMerger.java:283)
at com.android.ide.common.resources.ResourceMerger.mergeData(ResourceMerger.java:391)
at com.android.build.gradle.tasks.MergeResources.doTaskAction(MergeResources.kt:427)
... 119 more
Note this happens only with the release variant (I was unable to repro with a debuggable one).
lu...@google.com <lu...@google.com>
lu...@google.com <lu...@google.com> #4
Thanks for providing the repro case Ivan. The issue is the MERGED_NOT_COMPILED_RES directory was never added to our known list of Android resource source sets; causing the relative resource path lookup to fail. This should have been more obvious this was the case, however I assumed the relative path failure was a side effect of incorrect merging behaviour.
lu...@google.com <lu...@google.com> #5
The reason why this appeared to only impact release builds it that the MERGED_NOT_COMPILED_RES is often only only created when resource shrinking is enabled, so was less likely to appear for debug builds.
lu...@google.com <lu...@google.com>
pa...@gmail.com <pa...@gmail.com> #6
What is the fix version on this? I'm still seeing it in 7.4.2 without any experimental flags while trying to run lint, on second time it works fine, but it's really annoying.
kh...@gmail.com <kh...@gmail.com> #7
sa...@peilicke.de <sa...@peilicke.de> #8
In which AGP version has this been fixed? The issue is indeed still present in 7.4.2
lu...@google.com <lu...@google.com> #9
It appears the fix made it into 8.0, so unfortunately 7.4.2 is still affected.
Description
On CI builds we are seeing the following build failure happen occasionally during an incremental build. For example we do a build, then apply a change from a git commit, and build again.
We have enabled the following two properties for making the mergeResources task relocatable which could be the reason from looking at the stacktrace:
The app module also uses custom res source set locations in case that is relevant:
Stacktrace:
Version of Gradle Plugin: 7.0.0
Version of Gradle: Gradle 7.2
Version of Java: 11
OS: centOS