Status Update
Comments
li...@gmail.com <li...@gmail.com> #2
ch...@google.com <ch...@google.com>
je...@google.com <je...@google.com>
sp...@google.com <sp...@google.com> #4
for all who are looking for a solution use this:
ra...@google.com <ra...@google.com>
pa...@google.com <pa...@google.com>
pa...@google.com <pa...@google.com> #5
Thank you very much for reporting this. I think you are correct; something is broken here. Exactly what is broken depends on what was intended by the Lint authors. I'll continue to investigate.
li...@gmail.com <li...@gmail.com> #6
Any updates on this? Would be great to at least know if the issue is within the tests/testing framework/Lint itself.
pa...@google.com <pa...@google.com> #7
Sorry for the delay. There is definitely an issue with Lint itself; we will fix this.
The Android Gradle Plugin also behaves differently to the testing framework, such that the issue does not show up when using Gradle. This may take longer to fix, but once we fix the above issue with Lint, the difference in behavior probably won't be noticeable. It will only be noticeable if your Detector needs to read partial results from dependent modules (not including when you check all partial results in checkPartialResults
).
li...@gmail.com <li...@gmail.com> #9
Could you please share which version of Lint will include the fix?
sa...@google.com <sa...@google.com> #10
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Electric Eel Beta 4 (2022.1.1.14)
- Android Gradle Plugin 7.4.0-beta04
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
sa...@google.com <sa...@google.com> #11
The fixes for this issue are now also available in:
- Android Studio Flamingo Canary 7 (2022.2.1.7)
- Android Gradle Plugin 8.0.0-alpha07
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
li...@gmail.com <li...@gmail.com> #12
Hi again! After the Electric Eel release I went back to this issue. Using the same demo project I update the AGP to 7.4.0, Gradle to 7.5.1, Lint SDK to 30.4.0 and target/compile SDKs to 33. I ran the test, which was previously failing, and it still fails!
Could you please confirm, that after the fix, the issue is no longer reproducible in the demo project, which I shared in the opening message?
pa...@google.com <pa...@google.com>
li...@gmail.com <li...@gmail.com> #14
li...@gmail.com <li...@gmail.com> #15
I can confirm that the issue is fixed. Updating AGP to 8.0 and lint apis to 31.0.0 helps.
Description
DESCRIBE THE ISSUE IN DETAIL:
STEPS TO REPRODUCE:
./gradlew :app:lintDebug
and observe 2 issues;./gradlew :lint-checks:test
and observe tests failing.It looks like
PartialResult#map
doesn't follow the contract in unit tests. It claims to returnLintMap
for the project in context, but under the certain condition it seems to be violated.The conditions require multimodule setup. A
library
module must put smth into itsLintMap
. Then, when theapp
module accesses its ownLintMap
for the first time it get a map prefilled with the data from thelibrary
module, instead of the fresh one.To demonstrate the issue I created the following setup:
:app
module and a:library
module;:app
module containsapp_color
color resource, while:library
module contains:library_color
;color
resource declaration within the module, puts into the partial results and then reports all colors found per module incheckPartialResults
method;If you run lint checks using the
./gradlew :app:lintDebug
command, you'll observe Lint correctly reportingapp_color
found in:app
andlibrary_color
found in:library
. However, if you run the unit tests, you'll observe that Lint also reports alibrary_color
found in the:app
.It looks like while scanning the
:app
module, the first access to partial results, causesLintCliClient
to create new instance of results and fill it with results of the dependent module (seeLintCliClient#getPartialResults
method). For some reason this is happening only in tests.The replacement of the
getPartialResult.map()
method call withgetPartialResult.mapFor(context.project)
method call successfully addresses the issue.There's still a chance, that my test is wrong. In this case, would be great to know in which way.
Studio Build: Chipmunk | 2021.2.1 Version of Gradle Plugin: 7.2.1, 7.4.0-alpha08 Version of Gradle: 7.4.2 OS: Mac OS Monteray 12.4