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

Unfortunately, Crystal Ball has stopped.

hello everyone. i wasn't doing anything out of the ordinary, i was following the instructions and the app stopped opening after the vid where you add the black background. my log cat:

07-13 15:04:13.757: D/AndroidRuntime(3551): Shutting down VM 07-13 15:04:13.757: W/dalvikvm(3551): threadid=1: thread exiting with uncaught exception (group=0xb1ab3ba8) 07-13 15:04:13.777: E/AndroidRuntime(3551): FATAL EXCEPTION: main 07-13 15:04:13.777: E/AndroidRuntime(3551): Process: com.example.crystalball, PID: 3551 07-13 15:04:13.777: E/AndroidRuntime(3551): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crystalball/com.example.crystalball.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.ActivityThread.access$800(ActivityThread.java:135) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.os.Handler.dispatchMessage(Handler.java:102) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.os.Looper.loop(Looper.java:136) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.ActivityThread.main(ActivityThread.java:5017) 07-13 15:04:13.777: E/AndroidRuntime(3551): at java.lang.reflect.Method.invokeNative(Native Method) 07-13 15:04:13.777: E/AndroidRuntime(3551): at java.lang.reflect.Method.invoke(Method.java:515) 07-13 15:04:13.777: E/AndroidRuntime(3551): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 07-13 15:04:13.777: E/AndroidRuntime(3551): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 07-13 15:04:13.777: E/AndroidRuntime(3551): at dalvik.system.NativeStart.main(Native Method) 07-13 15:04:13.777: E/AndroidRuntime(3551): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 07-13 15:04:13.777: E/AndroidRuntime(3551): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:15) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.Activity.performCreate(Activity.java:5231) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 07-13 15:04:13.777: E/AndroidRuntime(3551): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 07-13 15:04:13.777: E/AndroidRuntime(3551): ... 11 more 07-13 15:04:18.007: I/Process(3551): Sending signal. PID: 3551 SIG: 9 07-13 15:15:03.637: D/AndroidRuntime(3601): Shutting down VM 07-13 15:15:03.637: W/dalvikvm(3601): threadid=1: thread exiting with uncaught exception (group=0xb1ab3ba8) 07-13 15:15:03.717: E/AndroidRuntime(3601): FATAL EXCEPTION: main 07-13 15:15:03.717: E/AndroidRuntime(3601): Process: com.example.crystalball, PID: 3601 07-13 15:15:03.717: E/AndroidRuntime(3601): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crystalball/com.example.crystalball.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.ActivityThread.access$800(ActivityThread.java:135) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.os.Handler.dispatchMessage(Handler.java:102) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.os.Looper.loop(Looper.java:136) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.ActivityThread.main(ActivityThread.java:5017) 07-13 15:15:03.717: E/AndroidRuntime(3601): at java.lang.reflect.Method.invokeNative(Native Method) 07-13 15:15:03.717: E/AndroidRuntime(3601): at java.lang.reflect.Method.invoke(Method.java:515) 07-13 15:15:03.717: E/AndroidRuntime(3601): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 07-13 15:15:03.717: E/AndroidRuntime(3601): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 07-13 15:15:03.717: E/AndroidRuntime(3601): at dalvik.system.NativeStart.main(Native Method) 07-13 15:15:03.717: E/AndroidRuntime(3601): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 07-13 15:15:03.717: E/AndroidRuntime(3601): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:15) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.Activity.performCreate(Activity.java:5231) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 07-13 15:15:03.717: E/AndroidRuntime(3601): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 07-13 15:15:03.717: E/AndroidRuntime(3601): ... 11 more 07-13 15:20:04.067: I/Process(3601): Sending signal. PID: 3601 SIG: 9

3 Answers

this happened to me too. I was following the instructions as is and it stopped working.

did you fix it?

No couldn't get it fixed. Hoping that someone in the forum will have instructions.

emulator doesnt work, used my phone to run the apps

Here is what you need to do

The error relates to java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

The video in treehouse uses the Theme called ** Theme.Black.NoTitleBar.Fullscreen ** . Are you using this?

If yes, then the new android update no longer supports this. However there is a work around as proposed by treehouse


1) Change your project back to using "AppTheme" like it was before in AndroidManifest.xml and the preview.

2) Add the following two lines to the file res/values/styles.xml (inside the <style name="AppTheme"> tag):

<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>

3) Set the background color to black in the file res/layout/activity_main.xml. The root element, RelativeLayout, is the one that makes up the whole screen. Add this line after the layout_height line but before the closing angle bracket >:

android:background="@android:color/black"

4) Change MainActivity to extend Activity, not ActionBarActivity


Hope this helps. Ask again if you have doubts.