Hey, I'm trying to open url in browser but getting...
# compose
s
Hey, I'm trying to open url in browser but getting
BadParcelableException
. My code seems like below
Copy code
class ArtworkDPVScreen(artwork:ItemArtwork){
    val localUriHandler = LocalUriHandler.current
Button(){
                    localUriHandler.openUri("${Endpoints.ASSETS_BASE_URL}0779b4bd-296f-671f-215e-129f2101ad07")
}
}
on button click url does open in the browser but app crash with following error stack:
🧵 3
on button click browser opens the url but app crash with following error stack:
Copy code
E  FATAL EXCEPTION: main
                                                                                                    Process: com.shoaibkakal.kart.androidApp, PID: 21267
                                                                                                    android.os.BadParcelableException: Parcelable encountered IOException writing serializable object (name = com.shoaibkakal.kart.presentation.ui.artwork_dpv.ArtworkDPVScreen)
                                                                                                    	at android.os.Parcel.writeSerializable(Parcel.java:2763)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2529)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2328)
                                                                                                    	at android.os.Parcel.writeList(Parcel.java:1394)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2472)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2328)
                                                                                                    	at android.os.Parcel.writeList(Parcel.java:1394)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2472)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2328)
                                                                                                    	at android.os.Parcel.writeMapInternal(Parcel.java:1245)
                                                                                                    	at android.os.Parcel.writeMap(Parcel.java:1227)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2442)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2328)
                                                                                                    	at android.os.Parcel.writeMapInternal(Parcel.java:1245)
                                                                                                    	at android.os.Parcel.writeMap(Parcel.java:1227)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2442)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2328)
                                                                                                    	at android.os.Parcel.writeList(Parcel.java:1394)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2472)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2328)
                                                                                                    	at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
                                                                                                    	at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
                                                                                                    	at android.os.Bundle.writeToParcel(Bundle.java:1362)
                                                                                                    	at android.os.Parcel.writeBundle(Parcel.java:1346)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2445)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2335)
                                                                                                    	at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
                                                                                                    	at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
                                                                                                    	at android.os.Bundle.writeToParcel(Bundle.java:1362)
                                                                                                    	at android.os.Parcel.writeBundle(Parcel.java:1346)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2445)
                                                                                                    	at android.os.Parcel.writeValue(Parcel.java:2335)
                                                                                                    	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:226)
                                                                                                    	at android.os.Looper.loop(Looper.java:313)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8762)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
                                                                                                    Caused by: java.io.NotSerializableException: com.shoaibkakal.kart.data.remote.models.artwork.ArtworkModel
                                                                                                    	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1240)
                                                                                                    	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1620)
                                                                                                    	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1581)
                                                                                                    	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1490)
                                                                                                    	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
                                                                                                    	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
c
Looks like your screen is trying to parcel the
ArtworkModel
. Do you have something like
rememberSaveableState
on this model?
s
No, i don't have any rememberSaveableState neither i'm passing
ArtworkModel
anywhere except this
ArtworkDPVScreen
constructor.
c
Another idea: a navigation library trying to persist your screen class.
👀 1