-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to parcelize parcelable objects #78
Comments
I also encountered this, for now I add Serializable into the mix to workaround this issue @parcelize |
Can confirm that this issue is still present in the latest version ( Take the example from documentation: https://voyager.adriel.cafe/state-restoration // ✔️ DO
@Parcelize
data class Post(/*...*/) : Parcelable
data class ValidScreen(
val userId: UUID, // Built-in serializable types
val post: Post // Your own parcelable and serializable types
) : Screen {
// ...
} This "DO" example will actually lead to a crash whenever |
@adrielcafe @DevSrSouza @Syer10 |
Facing this on |
if some one using it in a kmm app. you can do expect actual to get actual typealias CommonSerializable = java.io.Serializable
expect CommonSerializable and then data class SomeClass(val foo: String) : CommonSerializable |
1.0.0-rc04 and it is still present. @adrielcafe is there any new on this theme? |
The documentation was misleading, we have updated it with more samples and Multiplatform notice. |
Any update on this guys ???? |
@KapilYadav-dev i have updated my comment that solves this issue |
@Kashif-E what about desktop and ios for their platform? |
@KapilYadav-dev is just a plain interface in this case
|
In the documentation here we are explained to use @parcelize and Parcelable however when doing so, the app throws an exception when you tap home, leave the app or open another Intent:
FATAL EXCEPTION: main Process: ca.redacted, PID: 10491 java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = ca....redacted) at android.os.Parcel.writeSerializable(Parcel.java:2125) at android.os.Parcel.writeValue(Parcel.java:1895) at android.os.Parcel.writeList(Parcel.java:1104) at android.os.Parcel.writeValue(Parcel.java:1844) at android.os.Parcel.writeList(Parcel.java:1104) at android.os.Parcel.writeValue(Parcel.java:1844) at android.os.Parcel.writeArrayMapInternal(Parcel.java:987) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1620) at android.os.Bundle.writeToParcel(Bundle.java:1303) at android.os.Parcel.writeBundle(Parcel.java:1056) at android.os.Parcel.writeValue(Parcel.java:1813) at android.os.Parcel.writeArrayMapInternal(Parcel.java:987) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1620) at android.os.Bundle.writeToParcel(Bundle.java:1303) at android.os.Parcel.writeBundle(Parcel.java:1056) at android.os.Parcel.writeValue(Parcel.java:1813) at android.os.Parcel.writeArrayMapInternal(Parcel.java:987) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1620) at android.os.Bundle.writeToParcel(Bundle.java:1303) at android.app.IActivityTaskManager$Stub$Proxy.activityStopped(IActivityTaskManager.java:4969) at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:145) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8645) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) Caused by: java.io.NotSerializableException: ca...redacted at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1240) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1604) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1565) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354) at android.os.Parcel.writeSerializable(Parcel.java:2120) at android.os.Parcel.writeValue(Parcel.java:1895) at android.os.Parcel.writeList(Parcel.java:1104) at android.os.Parcel.writeValue(Parcel.java:1844) at android.os.Parcel.writeList(Parcel.java:1104) at android.os.Parcel.writeValue(Parcel.java:1844) at android.os.Parcel.writeArrayMapInternal(Parcel.java:987) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1620) at android.os.Bundle.writeToParcel(Bundle.java:1303) at android.os.Parcel.writeBundle(Parcel.java:1056) at android.os.Parcel.writeValue(Parcel.java:1813) at android.os.Parcel.writeArrayMapInternal(Parcel.java:987) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1620) at android.os.Bundle.writeToParcel(Bundle.java:1303) at android.os.Parcel.writeBundle(Parcel.java:1056) at android.os.Parcel.writeValue(Parcel.java:1813) at android.os.Parcel.writeArrayMapInternal(Parcel.java:987) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1620) at android.os.Bundle.writeToParcel(Bundle.java:1303) at android.app.IActivityTaskManager$Stub$Proxy.activityStopped(IActivityTaskManager.java:4969) at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:145) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8645) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
In fact the example given in the documentation doesn't work.
Versions used:
val voyager_version = 1.0.0-rc02
id org.jetbrains.kotlin.android version 1.7.0 apply false
I did see this thread: ##59 but even when using something like:
The app still crashes.
The text was updated successfully, but these errors were encountered: