Repository navigation
feat(android): [minSdk 26 1] Raise minSdk from 21 to 26 - #6435
runningcode wants to merge 3 commits into
Conversation
Raise the minimum supported Android API level of all Android modules to 26. The sample and the sqlite tests no longer need to override the floor for androidx.sqlite. Robolectric cannot load an APK below its minSdk, so core tests now default to API 26. Tests that only covered pre-26 code paths are removed, and tests whose behavior differs on API 26 are adjusted. ObsoleteSdkInt is disabled until the next change removes the checks this makes obsolete. Refs JAVA-547 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
📲 Install BuildsAndroid
|
The UI test app had two version checks that minSdk 26 makes obsolete. The R8 bundled with AGP 9.0 and 9.2 crashes with a NullPointerException in its API level database while optimizing androidx.core's LocationManagerCompat at minSdk 26. When VERSION_AGP overrides AGP, as in the AGP matrix, put the R8 from the default AGP 9.4.0 ahead of AGP on the buildscript classpath. Refs JAVA-547 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| object BuildPlugins { | ||
| val androidGradle = "com.android.tools.build:gradle:$AGP" | ||
|
|
||
| // The R8 bundled with AGP 9.0 and 9.2 crashes on androidx.core at minSdk 26, so builds that |
There was a problem hiding this comment.
this is probably the only line that needs reviewing.
i also tried
- upgrading androidx.core
- adding a keep rule
but neither works. open to other ideas.
There was a problem hiding this comment.
what's the exact crash here? Maybe there's an open issue around this on the issue tracker, we could link here.
There was a problem hiding this comment.
The crash is
java.lang.NullPointerException: Cannot invoke "com.android.tools.r8.androidapi.f$a.a()" because the return value of "com.android.tools.r8.androidapi.f.H()" is null
My clanker explains it like so:
Retraced, it’s Inliner.inlineInvoke → DexEncodedMethod.copyMetadata → ComputedApiLevel.max, which hits a NotSetApiLevel. That’s R8 failing inside its own Android API-level tracking.
R8 was inlining into R8’s renamed copy of androidx.core 1.15’s LocationManagerCompat.lambda$registerGnssStatusCallback$1 (the addGpsStatusListener path for API 23 and lower).```
I'm not sure there is value in opening an issue on the issue tracker since it is already fixed. This doesn't crash on the newer version of R8 that we're pinning.
PR Stack (minSdk 26)
📜 Description
Raises
minSdkfor all Android modules from 21 to 26. This doesn't remove the dead code.Note: R8 version had to be forced otherwise CI failed the android integration tests. Open to other ideas on that one, see my comment in the code.
💡 Motivation and Context
💚 How did you test it?
CI Passes
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
SDK_INTchecks made obsolete by this change and turnObsoleteSdkIntback on (next PR in the stack)