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

InteractiveStory has stopped

I run my interactive story and it stops after I click on the button to begin. Here is my error dump... the only difference I see in my code from the presented code was that the Activity extend ActionBarActivity and not Activity. Any idea what may be causing this?

--------- beginning of crash 07-12 23:58:29.594 8211-8211/com.gregvestal.interactivestory E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.gregvestal.interactivestory, PID: 8211 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gregvestal.interactivestory/com.gregvestal.interactivestory.ui.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.gregvestal.interactivestory.ui.MainActivity" on path: DexPathList[[zip file "/data/app/com.gregvestal.interactivestory-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.gregvestal.interactivestory.ui.MainActivity" on path: DexPathList[[zip file "/data/app/com.gregvestal.interactivestory-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.Instrumentation.newActivity(Instrumentation.java:1065) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)             at android.app.ActivityThread.access$800(ActivityThread.java:144)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)             at android.os.Handler.dispatchMessage(Handler.java:102)             at android.os.Looper.loop(Looper.java:135)             at android.app.ActivityThread.main(ActivityThread.java:5221)             at java.lang.reflect.Method.invoke(Native Method)             at java.lang.reflect.Method.invoke(Method.java:372)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Suppressed: java.lang.ClassNotFoundException: com.gregvestal.interactivestory.ui.MainActivity at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 13 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

1 Answer

It didn't find the class. Make sure that you've written the class name properly in your call for it and that your imports are organized. You could try to Clean (Build) the project too and see if that helps; there could be some broken path. There is no issue with you extending ActionBarActivity.