Trying to migrate Android native view to Jetpack compose.
Added dependencies per Jetpack-compose-migration#3 in build.gradle
I'm still getting below exception.
java.lang.NoSuchMethodError: No virtual method setContent(Lkotlin/jvm/functions/Function0;)V in class Landroidx/compose/ui/platform/ComposeView;
Any help on this?
Trying to solve this exception.
Jetpack Compose doesn't use Activity class to your activities, it uses ComponentActivity.
You can add this implementation to use:
implementation 'androidx.activity:activity-compose'
And in your activity that contains the setContent function:
Replace class MainActivity: Activity() for class MainActivity: ComponentActivity()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With