Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
[ID: 558956]
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Attachment actions
Description
(Using latest AGP 8.9 dev build.)
I had a stray character at the end of an XML layout file:
This is still a valid XML file, and aapt would happily package it and the app would run.
However, when I build this project, the build fails. But, it's NOT pointing to the real source file with the problem. See the first screenshot.
If I click on the build output tree and click on the previous node, I can see a bit more detail, but it's still not pointing to the source file with the problem; instead, it's pointing off into app/build/intermediates/packaged_res/debug/packageDebugResources etc for some kind of intermediate derived resource file.
There are two things we should fix here.
(1) When there is a valid problem with an XML resource file, we need to map back to the original source file and link to that file instead. We do that for various other XML errors; for example, I added
android:layout_height="@string/foo"
to the XML file, and when I build now I get a build error which points to the right file (though the line number seems to be off by one!)(2) At least until we fix (1), we shouldn't block on this error. It's fine to include text in a layout file. Warn yes, error no. (And we already have a lint warning for this:https://googlesamples.github.io/android-custom-lint-rules/checks/ExtraText.md.html )