Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build an Interactive Story App The Rest of the Story Wrapping Up

Could not find class 'android.graphics.drawable.RippleDrawable'

I get this error

09-10 09:12:25.393 597-597/? E/Zygote: Zygote:  error closing descriptor
                                       libcore.io.ErrnoException: close failed: EBADF (Bad file number)
                                           at libcore.io.Posix.close(Native Method)
                                           at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)
                                           at com.android.internal.os.ZygoteInit.closeServerSocket(ZygoteInit.java:221)
                                           at com.android.internal.os.ZygoteConnection.handleChildProc(ZygoteConnection.java:879)
                                           at com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:242)
                                           at com.android.internal.os.ZygoteInit.runSelectLoop(ZygoteInit.java:715)
                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
                                           at dalvik.system.NativeStart.main(Native Method)
09-10 09:12:28.814 597-597/com.zakawat.interactivestory E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
09-10 09:12:29.622 597-597/com.zakawat.interactivestory E/ffi_jank: timespan = 59.54523
09-10 09:12:29.980 597-597/com.zakawat.interactivestory E/ffi_jank: timespan = 18.947845
09-10 09:17:21.292 597-597/com.zakawat.interactivestory E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: com.zakawat.interactivestory, PID: 597
                                                                          java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zakawat.interactivestory/com.zakawat.interactivestory.ui.StoryActivity}: java.lang.NullPointerException
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
                                                                              at android.app.ActivityThread.access$800(ActivityThread.java:155)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:110)
                                                                              at android.os.Looper.loop(Looper.java:193)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5388)
                                                                              at java.lang.reflect.Method.invokeNative(Native Method)
                                                                              at java.lang.reflect.Method.invoke(Method.java:515)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:655)
                                                                              at dalvik.system.NativeStart.main(Native Method)
                                                                           Caused by: java.lang.NullPointerException
                                                                              at com.zakawat.interactivestory.ui.StoryActivity.loadPage(StoryActivity.java:60)
                                                                              at com.zakawat.interactivestory.ui.StoryActivity.onCreate(StoryActivity.java:50)
                                                                              at android.app.Activity.performCreate(Activity.java:5280)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2322)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410) 
                                                                              at android.app.ActivityThread.access$800(ActivityThread.java:155) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:110) 
                                                                              at android.os.Looper.loop(Looper.java:193) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5388) 
                                                                              at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                              at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:655) 
                                                                              at dalvik.system.NativeStart.main(Native Method) 

when compiler reach Drawable image line:

    private void loadPage(int pageNumber) {
        pageStack.push(pageNumber);

        final Page page = story.getPage(pageNumber);
        Drawable image = ContextCompat.getDrawable(this, page.getImageId()); //Error Line
        storyImageView.setImageDrawable(image);

        String pageText = getString(page.getTextId());
        pageText = String.format(pageText, name);
        storyTextView.setText(pageText);

After Debugging for a while I found this

alt text