ionic-team / ionic-portals-android

Other
4 stars 3 forks source link

Jetpack compose crash #33

Closed jcfrk101 closed 1 year ago

jcfrk101 commented 1 year ago

java.lang.ClassCastException: androidx.compose.ui.tooling.PreviewActivity cannot be cast to androidx.appcompat.app.AppCompatActivity at io.ionic.portals.PortalView.loadPortal(PortalView.kt:79) at io.ionic.portals.PortalView.(PortalView.kt:41) at io.ionic.portals.PortalView.(PortalView.kt:34) at com.terra.app.MainActivityKt$MainContent$1$1$1.invoke(MainActivity.kt:62) at com.terra.app.MainActivityKt$MainContent$1$1$1.invoke(MainActivity.kt:61)`

jcfrk101 commented 1 year ago

Just to add context this also occurs with MainActivity

java.lang.ClassCastException: com.terra.app.MainActivity cannot be cast to androidx.appcompat.app.AppCompatActivity
carlpoole commented 1 year ago

Hi there. The way Portals currently works it needs the containing activity to be an extension of AppCompatActivity() since it uses Fragments. From the errors you posted it seems like this may not be the case. Are you able to make the containing activity extend AppCompatActivity() and see if that fixes your issue?