bumble-tech / appyx

Model-driven navigation + UI components with gesture control for Compose Multiplatform
https://bumble-tech.github.io/appyx/
Apache License 2.0
1.14k stars 62 forks source link

Crash when launching image picker #435

Open felislynx-silae opened 1 year ago

felislynx-silae commented 1 year ago

When i launch gallery pick activity, app is crashing:

java.lang.IllegalArgumentException: Parcel: unknown type for value eu.lynxit.editor.RootNode$NavTarget$NewProjectPage@cee66ee
                                                                                                        at android.os.Parcel.getValueType(Parcel.java:2409)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2308)
                                                                                                        at com.bumble.appyx.core.navigation.NavKey.writeToParcel(Unknown Source:8)
                                                                                                        at android.os.Parcel.writeParcelable(Parcel.java:2538)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2439)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2316)
                                                                                                        at android.os.Parcel.writeMapInternal(Parcel.java:1232)
                                                                                                        at android.os.Parcel.writeMap(Parcel.java:1215)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2430)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2316)
                                                                                                        at android.os.Parcel.writeList(Parcel.java:1382)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2460)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2316)
                                                                                                        at android.os.Parcel.writeArrayMapInternal(Parcel.java:1265)
                                                                                                        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
                                                                                                        at android.os.Bundle.writeToParcel(Bundle.java:1389)
                                                                                                        at android.os.Parcel.writeBundle(Parcel.java:1334)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2433)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2323)
                                                                                                        at android.os.Parcel.writeArrayMapInternal(Parcel.java:1265)
                                                                                                        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
                                                                                                        at android.os.Bundle.writeToParcel(Bundle.java:1389)
                                                                                                        at android.os.Parcel.writeBundle(Parcel.java:1334)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2433)
                                                                                                        at android.os.Parcel.writeValue(Parcel.java:2323)
                                                                                                        at android.os.BaseBundle.dumpStats(BaseBundle.java:1874)
                                                                                                        at android.os.BaseBundle.dumpStats(BaseBundle.java:1911)
                                                                                                        at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:150)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:942)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                        at android.os.Looper.loop(Looper.java:288)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7872)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
var spaceplaValue by remember { mutableStateOf(TextFieldValue("")) }
var selectImages by remember { mutableStateOf(listOf<Uri>()) }
val galleryLauncher =
     rememberLauncherForActivityResult(ActivityResultContracts.GetMultipleContents()) { uriList ->
            selectImages = uriList
     }

In onClick:

galleryLauncher.launch("image/*")

Also, this happens with:

activityStarter.startActivityForResult(this, 15) {
                Intent(Intent.ACTION_GET_CONTENT).apply {
                    addCategory(Intent.CATEGORY_OPENABLE)
                    type = "image/*"
                }
            }
KovalevAndrey commented 1 year ago

Hi @felislynx-silae, how does your NavTarget look like? Look like it doesn't implement Parcelable interface. Issue for the reference https://github.com/bumble-tech/appyx/issues/310