Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Lifecycle Runtime Compose to 2.8.2 #5047

Closed
blakelee opened this issue Jun 28, 2024 · 4 comments
Closed

Update Lifecycle Runtime Compose to 2.8.2 #5047

blakelee opened this issue Jun 28, 2024 · 4 comments
Assignees
Labels
android question Not a bug, but question or comment upstream (AOSP) Issue is in Google issue tracker

Comments

@blakelee
Copy link

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

  • Android (I know the template says to use the Android issue tracker, but this is a Jetbrains issue to update the binary that includes the fix)

Versions

  • Libraries:
    • org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose:2.8.0

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
square/leakcanary#2677

@blakelee blakelee added bug Something isn't working submitted labels Jun 28, 2024
@MatkovIvan
Copy link
Member

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.

@MatkovIvan MatkovIvan added upstream (AOSP) Issue is in Google issue tracker android and removed bug Something isn't working submitted labels Jun 29, 2024
@blakelee
Copy link
Author

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.

@MatkovIvan
Copy link
Member

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".

@MatkovIvan MatkovIvan self-assigned this Jul 1, 2024
@MatkovIvan MatkovIvan added the question Not a bug, but question or comment label Jul 1, 2024
@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
android question Not a bug, but question or comment upstream (AOSP) Issue is in Google issue tracker
Projects
None yet
Development

No branches or pull requests

3 participants