google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.43k stars 598 forks source link

Unable to use v0.29.0-alpha due to Compose 1.4.0-alpha04 regression #1474

Closed leinardi closed 1 year ago

leinardi commented 1 year ago

Describe the bug

Compose 1.4.0-alpha04 introduced a regression that make the app crash if you make use of KeyboardActions (see: https://issuetracker.google.com/issues/265172081).

This crash does not happen with 1.4.0-alpha04 but, unfortunately, downgrading to it is not so easy since v0.29.0-alpha forces the use of 1.4.0-alpha04.

To Reproduce

Steps to reproduce the behavior:

  1. Check out this branch: https://github.com/leinardi/basic-m3-compose-with-mdc/tree/accompanist
  2. Run the app and see that crashes
  3. Comment/delete implementation "com.google.accompanist:accompanist-navigation-material:0.29.0-alpha"
  4. Run the app and see that works fine

Expected behavior

I expect to be able to use accompanist alpha together with Compose 1.4.0-alpha03, to avoid the crash with the KeyboardActions

Environment:

Additional context

It would be nice to have a version of accompanist that uses Compose 1.4.0-alpha03, so that it would still be possible to use it while waiting for the upstream fix.

bentrengrove commented 1 year ago

Unfortunately we can't downgrade because of the NavigationMaterial fixes/api changes being in alpha04. I think we might be stuck here waiting for the upstream fix.

jossiwolf commented 1 year ago

See Andrew's comment on the upstream issue:

Thanks for the report! This is due to an issue in the Compose Compiler where marking a class as @Stable would generate binaries that aren't ABI compatible with previous library versions. KeyboardActions was recently marked as @Stable which is where this issue is stemming from.

We've addressed this issue in the compiler to prevent this from happening in the future. The crash you reported will be fixed when we release the next version of the Foundation library, which will be compiled with this patch in place. The fix here only affects the Foundation library, so you won't need to update any other libraries and library owners won't have to make any changes after we publish this fix.

You may also see this issue in other libraries or modules if they have Composable UI elements that utilize KeyboardActions internally and were compiled against Foundation 1.4.0-alpha03 or earlier.

As a workaround for material3, you can upgrade to the latest alpha release, which is version 1.1.0-alpha04. For material, use version 1.4.0-alpha04. Alternatively, you can downgrade the Foundation library to version 1.4.0-alpha03 and upgrade to the next release when it's available.

https://issuetracker.google.com/issues/265172081#comment2

leinardi commented 1 year ago

Yeah, I saw the comments on the upstream issue and I can confirm that upgrading to androidx.compose.material3:material3:1.1.0-alpha04 seems to be a valid workaround.

yuroyami commented 1 year ago

Crash confirmed to occur on APIs 33, 32, 31, 30, physical devices are used. Hope the upstream fix comes up soon.