前言

记录一下使用Bundle.putParcelable()或Bundle.putParcelableArrayList()传输Parcelable数量时出现的问题,方便自己查阅。

正文

报错日志

Parcel  (14686): Class not found when unmarshalling: com.biumall.music.lrc.LrcContext
Parcel  (14686): java.lang.ClassNotFoundException: com.biumall.music.lrc.LrcContext
Parcel  (14686):   at java.lang.Class.classForName(Native Method)
Parcel  (14686):   at java.lang.Class.forName(Class.java:453)
Parcel  (14686):   at android.os.Parcel.readParcelableCreator(Parcel.java:2811)
Parcel  (14686):   at android.os.Parcel.readParcelable(Parcel.java:2765)
...
Parcel  (14686): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
AndroidRuntime(14686): FATAL EXCEPTION: main
AndroidRuntime(14686): Process: com.biumall.music, PID: 14686
AndroidRuntime(14686): android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.biumall.music.lrc.LrcContext

解决方式

我这里是想通过Bundle上传歌词给UI层。

Bundle bundle = new Bundle();
bundle.putParcelable(Constant.MEDIA_LRC_LIST, mLrcContext);
mMediaStatus.mProgress = progress;
mMediaSession.setPlaybackState(new PlaybackState.Builder()
        .setState(state, progress, playbackSpeed)
        .setExtras(bundle)
        .build());

然后运行后就出现上面的异常日志,重点提示找不到LrcContext这个类。

Parcel  (14686): Class not found when unmarshalling: com.biumall.music.lrc.LrcContext
Parcel  (14686): java.lang.ClassNotFoundException: com.biumall.music.lrc.LrcContext

一种情况可以看参考文哈

我这里分出行的两种情况,都是跟上面异常一样现象。

隐藏内容!
付费阅读后才能查看!
2
3
多个隐藏块只需支付一次

参考文章

  1. Class not found when unmarshalling: com.xx.xx.bean.ImagesSet

相关文章

暂无评论

none
暂无评论...