Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Intents and Broadcast Receivers Implicit Intents and Intent Filters Sharing Songs with a Custom Intent

Aida Eduard
Aida Eduard
8,499 Points

Class not found when unmarshalling

Hello, here is my problem: when choosing a song and pressing Share Song in menu the app crashes and this errors appears:

E/Parcel: Class not found when unmarshalling: ~.musicmachine.models.Song java.lang.ClassNotFoundException: ~.musicmachine.models.Song at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:400) at android.os.Parcel.readParcelableCreator(Parcel.java:2507) at android.os.Parcel.readParcelable(Parcel.java:2461) at android.os.Parcel.readValue(Parcel.java:2364) at android.os.Parcel.readArrayMapInternal(Parcel.java:2717) at android.os.BaseBundle.unparcel(BaseBundle.java:269) at android.os.BaseBundle.getBoolean(BaseBundle.java:731) at android.content.Intent.getBooleanExtra(Intent.java:6112) at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:317) at android.app.Activity.performCreate(Activity.java:6757) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2704) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2812) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6317) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) Caused by: java.lang.ClassNotFoundException: ~.musicmachine.models.Song at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:1346) at java.lang.BootClassLoader.loadClass(ClassLoader.java:1406) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:400)  at android.os.Parcel.readParcelableCreator(Parcel.java:2507)  at android.os.Parcel.readParcelable(Parcel.java:2461)  at android.os.Parcel.readValue(Parcel.java:2364)  at android.os.Parcel.readArrayMapInternal(Parcel.java:2717)  at android.os.BaseBundle.unparcel(BaseBundle.java:269)  at android.os.BaseBundle.getBoolean(BaseBundle.java:731)  at android.content.Intent.getBooleanExtra(Intent.java:6112)  at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:317)  at android.app.Activity.performCreate(Activity.java:6757)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2704)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2812)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6317)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

E/AndroidRuntime: FATAL EXCEPTION: main Process: android:ui, PID: 7557 java.lang.RuntimeException: Unable to start activity ComponentInfo{android/com.android.internal.app.ChooserActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: ~.musicmachine.models.Song at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2812) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6317) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: ~.musicmachine.models.Song at android.os.Parcel.readParcelableCreator(Parcel.java:2535) at android.os.Parcel.readParcelable(Parcel.java:2461) at android.os.Parcel.readValue(Parcel.java:2364) at android.os.Parcel.readArrayMapInternal(Parcel.java:2717) at android.os.BaseBundle.unparcel(BaseBundle.java:269) at android.os.BaseBundle.getBoolean(BaseBundle.java:731) at android.content.Intent.getBooleanExtra(Intent.java:6112) at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:317) at android.app.Activity.performCreate(Activity.java:6757) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2704) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2812)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6317)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) 

Code is identical to the one in the the video