Status Update
Comments
au...@google.com <au...@google.com> #2
I've submitted a fix for this, which should (I hope) make it into Jellyfish Canary 12. There's a relatively straightforward workaround, which is to explicitly declare the version of the com.android.tools.build:gradle
artifact in all build files -- in the screenshot, your project has a versioned classpath
dependency, but also an unversioned one, and it's that unversioned one that tripped up the AGP Upgrade Assistant. Since there is that workaround of making sure that all the classpath dependencies on com.android.tools.build:gradle
have an explicit version, we probably won't patch this for Iguana, I'm afraid.
Thanks very much for the report!
gh...@google.com <gh...@google.com> #3
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 Jellyfish | 2023.3.1 Canary 12
- Android Gradle Plugin 8.4.0-alpha12
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!
tn...@google.com <tn...@google.com> #4
ra...@google.com <ra...@google.com> #5
js...@google.com <js...@google.com> #6
js...@google.com <js...@google.com> #7
(I'm just looking at the master branch in the Kotlin repository but I really need to look at the exact same snapshot to make this work.)
Then, hope there will be a systematic way to update the bytecode rewriter when we update the artifacts next time...?
js...@google.com <js...@google.com> #8
^ It looks like I misunderstood what artifacts the bytecode rewriter is going to rewrite: not lint-psi, but runtime loaded custom Lint checks that may use incompatible APIs.
tn...@google.com <tn...@google.com> #9
I have a version of this working now:
With this I'm able to load all the broken AndroidX libraries I'm aware of:
// Broken from 2.8.0-beta04 to 2.8.0-beta07
implementation("androidx.navigation:navigation-compose:2.8.0-beta07")
// Broken from 2.8.0-beta04 to 2.8.0-beta07
implementation("androidx.navigation:navigation-runtime:2.8.0-beta07")
// Broken from 2.8.0-beta04 to 2.8.0-beta07
implementation("androidx.navigation:navigation-common:2.8.0-beta07")
// Broken from 1.7.0-alpha02 to 1.7.0-beta07
implementation("androidx.compose.ui:ui-android:1.7.0-beta07")
// Broken from 1.7.0-alpha02 to 1.7.0-beta07
implementation("androidx.compose.runtime:runtime-android:1.7.0-beta07")
// Broken from 2.8.0 to 2.9.0-alpha01
implementation("androidx.lifecycle:lifecycle-livedata-core:2.9.0-alpha01")
and I've been able to trigger some of these lint checks as well.
(I still need to clean up the CL a bit and add more tests but wanted to share since I'm going to be in meetings for most of the day in case others want to play with it. In particular, I'm not sure I've triggered all the conditions in in the test project to hit all the paths related to the analysis API; some of the unit tests in the androidx source base don't appear to use current signatures to doesn't compile in my test project.)
au...@google.com <au...@google.com> #10
Is there a version (even locally built) of AGP that we can try to see if androidx is happy with the new workarounds?
tn...@google.com <tn...@google.com> #11
Here's repo.zip:
This is a build of my out/repo folder in Studio with these changes applied -- and I tested this with an AGP project (which I've attached to this bug report). In that project I tried to trigger various androidx lint checks used by those lint jars -- I've got a few (livedata, ui-android). But I struggled to find test cases for some of them -- I think what I need to do is figure out what test cases to put into this project to trigger all the code paths that touch the kotlin analysis API usages in these lint checks, and I'm not sure exactly what those are.
For the navigation tests in particular, I found some unit tests, but the unit tests don't look current anymore; I'm assuming they're using stubs that haven't been updated, because when I pasted them into the project the code doesn't compile. It might be good to get those updated.
P.S. The build of AGP is using version 8.7.0-dev. My attached project points to it where it lives on my system (the out/repo/ folder of my studio main checkout.)
tn...@google.com <tn...@google.com> #12
This is fixed by
sp...@google.com <sp...@google.com> #14
Re-opening this bug because of #13. Feel free to close or reassign to me if you think that's out of scope of the original bug, Tor.
tn...@google.com <tn...@google.com> #16
This is happening because AndroidX turns off lint's bytecode verifier. It's the bytecode verifier that figures out a lint jar is using incompatible APIs, detects that it's the analysis API, and then does bytecode patching in order for things to work. Without the bytecode verifier you're running the original lint checks which are using nonexistent classes -- because the analysis API has changed.
(It looks like this is done in a modified version of gradlew
, line 41: export ANDROID_LINT_SKIP_BYTECODE_VERIFIER=true
.)
Longer term you'll want to update the AndroidX source base to use the new analysis APIs directly, but if you do that now the new AndroidX libraries won't work with older AGPs and IDEs so I guess holding off a cycle or two is good.
I'm marking this bug as fixed since we've used it to track the external issue that AndroidX lint checks stopped working in 8.7.0-alpha04, which is now fixed by the bytecode verifier. If there's additional work to be done on AndroidX' internal setup let's use a different issue for it (since this bug will be referenced in release notes, the fix is going into canaries etc.)
fs...@google.com <fs...@google.com> #17
Thanks for explaining Tor, that makes sense. I've filed
js...@google.com <js...@google.com>
an...@google.com <an...@google.com> #18
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 Ladybug Feature Drop | 2024.2.2 Canary 1
- Android Gradle Plugin 8.8.0-alpha01
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!
an...@google.com <an...@google.com> #19
The fixes for this issue are now also available in:
- Android Studio Ladybug | 2024.2.1 Beta 2
- Android Gradle Plugin 8.7.0-beta02
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
md...@gmail.com <md...@gmail.com> #20
We are grateful
Description
We are in the process of upgrading AndroidX to AGP version 8.7.0-alpha04 (or higher) and have run into an issue with some existing published lint checks which are now failing due to
java.lang.NoClassDefFoundError: org/jetbrains/kotlin/analysis/api/session/KtAnalysisSessionProvider
We currently run with
ANDROID_LINT_SKIP_BYTECODE_VERIFIER=true
, enabling the bytecode verifier correctly skips these checks.However, if I understand the situation the incompatibility will still cause these recently published checks to be disabled until users are able to upgrade to a version published after AndroidX has upgraded, and in addition to that those same checks on the new version will be disabled for anyone using a version prior to 8.7.0-alpha04.
I see we're doing some clever type aliasing to handle this situation elsewhere. Could we do something similar or find some other solution to get these checks running across a broader range of versions?