Closed blakelee closed 12 hours ago
but this is a Jetbrains issue to update the binary that includes the fix
We're redirecting original Google's binaries on Android, it allows avoiding conflicts with Android-only libraries and update that part in project independently.
Just add a patched Google dependency to your androidMain
sourceset.
PS There is 2.8.3 with proper ProGuard rules for that compatibility reflection hack.
Neat, so if I'm following correctly I can just do something like this? I'm not seeing a 2.8.3 anywhere yet, I'm not as familiar with the android.googlesource.com for finding these things. Hopefully this post will help out others that are struggling with the same issue.
kotlin {
...
sourceSets {
commonMain.dependencies {
implementation("org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose:2.8.0")
}
androidMain.dependencies {
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.2")
}
}
}
Does adding the Android dependencies for other things also work? I'm assuming as long as the Kotlin version and Compose compiler are the same I can just put other updated libraries in androidMain
.
Does adding the Android dependencies for other things also work?
It will work for JetBrains' multiplatform adoptions of compose/lifecycle/navigation. It works because we don't even re-build android and uses redirection to Google's binaries on platforms where supported. Aside of independent applying of patches, it allows using Android-only libraries with these dependencies without issues like "Duplicate class declarations".
The Jetbrains version of the lifecycle library depends on Android's lifecycle 2.8.0. Version 2.8.2 fixes some annoying issues with the LocalLifecycleOwner. I'm requesting that we update Jetbrains lifecycle to 2.8.2 to match the Android version.
Affected platforms
Versions
Here's the Google issue tracker fix of it https://android-review.googlesource.com/c/platform/frameworks/support/+/3096018
The issue was seen in a standard UI test similar to this https://github.com/square/leakcanary/issues/2677