前言
记录一下使用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
一种情况可以看参考文哈
我这里分出行的两种情况,都是跟上面异常一样现象。
参考文章
《
© 版权声明