https://kotlinlang.org logo
#compose
Title
# compose
a

Alex Barcelo

02/11/2021, 6:25 PM
Is it possible that latest Navigation Compose is missing a dependency with
activity-compose
? When calling NavHost(…) the app crashs with
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/activity/compose/LocalOnBackPressedDispatcherOwner;
. I added the following dependency to my project:
Copy code
implementation("androidx.activity:activity-compose:1.3.0-alpha02")
and not it seems to work smoothly
i

Ian Lake

02/11/2021, 6:29 PM
You need to add an explicit dependency on
activity-compose:1.3.0-alpha02
to get it working, yes.
🙏 1
a

Alex Barcelo

02/11/2021, 6:37 PM
I thought this was related to a missing dependency inside
navigation-compose
and not much with using libraries compiled with an unstable release of Kotlin (after upgrading project to a stable version). Thanks!
i

Ian Lake

02/11/2021, 6:41 PM
It is more that
navigation-compose
depends on the broken
activity-compose:1.3.0-alpha01
. By updating the alpha02, you're using what
navigation-compose
expected all along
Which, in this case, is the existence of the
LocalOnBackPressedDispatcherOwner
and related APIs
👍 2