Open zzzhouuu opened 7 years ago
AS 的 instant run 关闭试试
已经关闭了,但是涉及到第三方库使用到Parcelable还是会Crash Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.sina.weibo.sdk.api.TextObject
我们有个类叫ParcelUtils,在plugin-lib中,您可以试试调用那个方法来做。
从现象上看,应该是不同的ClassLoader使用了相同的Parcelable才会出现问题。
请问你的问题解决了嘛? 我也出现了涉及到第三方库使用到Parcelable还是会Crash
@jiongxuan 我也遇到这种问题,插件Activity里面有使用Fragment, 切后台回来后容易出现。 01-19 00:03:37.220 E/AndroidRuntime(19687): Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.v4.app.FragmentManagerState 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.os.Parcel.readParcelableCreator(Parcel.java:2438) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.os.Parcel.readParcelable(Parcel.java:2359) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.os.Parcel.readValue(Parcel.java:2265) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.os.Parcel.readArrayMapInternal(Parcel.java:2620) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.os.BaseBundle.unparcel(BaseBundle.java:221) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.os.BaseBundle.getBoolean(BaseBundle.java:659) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.app.Activity.restoreHasCurrentPermissionRequest(Activity.java:7153) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.app.Activity.performCreate(Activity.java:6903) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) 01-19 00:03:37.220 E/AndroidRuntime(19687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266) 01-19 00:03:37.220 E/AndroidRuntime(19687): ... 9 more
该问题没有解决办法吗?
同样也发现这个问题,有解决的方法了么
应该是无解的,要么把这个类挪到宿主,要么就不要把插件的类Parcelable化
插件引入BiliShare(https://github.com/Bilibili/BiliShare) ,将Sample代码转成Plugin,插件工程单独运行没有问题,放入host调用就会有下面的异常日志
Process: com.dzxwapp.application.dev, PID: 7878 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dzxwapp.application.dev/com.dzxwapp.application.dev.loader.a.ActivityN1NRTS1}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.bilibili.socialize.share.core.BiliShareConfiguration at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2833) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1621) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:159) at android.app.ActivityThread.main(ActivityThread.java:6326) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883) Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.bilibili.socialize.share.core.BiliShareConfiguration at android.os.Parcel.readParcelableCreator(Parcel.java:2536) at android.os.Parcel.readParcelable(Parcel.java:2462) at android.os.Parcel.readValue(Parcel.java:2365) at android.os.Parcel.readArrayMapInternal(Parcel.java:2732) at android.os.BaseBundle.unparcel(BaseBundle.java:269) at android.os.Bundle.getParcelable(Bundle.java:864) at android.content.Intent.getParcelableExtra(Intent.java:6438) at com.bilibili.socialize.share.core.ui.BiliShareDelegateActivity.resolveParams(BiliShareDelegateActivity.java:133) at com.bilibili.socialize.share.core.ui.BiliShareDelegateActivity.onCreate(BiliShareDelegateActivity.java:90) at android.app.Activity.performCreate(Activity.java:6805) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2776) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1621) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:159) at android.app.ActivityThread.main(ActivityThread.java:6326) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
RePlugin version: replugin_version 2.1.5
Android compile SDK version: compileSdkVersion 25 buildToolsVersion 26.0.0
Android ROM: Smartisan OD105 Android7.1.1 API 25