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" error, please help

I just got to the Android App Development track project on adding an image to my app and changing the theme. Everything was working fine and I followed the directions step by step but I have warning signs on my ImageView and Button. When trying to run the app on my emulator I get the message "Unfortunately, Crystal Ball has stopped" and these errors appear in the log. Please help so that I can continue with my track! Thank you

05-03 12:04:29.860: E/AndroidRuntime(1082): FATAL EXCEPTION: main

05-03 12:04:29.860: E/AndroidRuntime(1082): Process: com.crossboss.crystalball, PID: 1082

05-03 12:04:29.860: E/AndroidRuntime(1082): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crossboss.crystalball/com.crossboss.crystalball.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.ActivityThread.access$800(ActivityThread.java:135)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.os.Handler.dispatchMessage(Handler.java:102)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.os.Looper.loop(Looper.java:136)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.ActivityThread.main(ActivityThread.java:5017)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at java.lang.reflect.Method.invokeNative(Native Method)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at java.lang.reflect.Method.invoke(Method.java:515)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at dalvik.system.NativeStart.main(Native Method)

05-03 12:04:29.860: E/AndroidRuntime(1082): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at com.crossboss.crystalball.MainActivity.onCreate(MainActivity.java:18)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.Activity.performCreate(Activity.java:5231)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)

05-03 12:04:29.860: E/AndroidRuntime(1082):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)

05-03 12:04:29.860: E/AndroidRuntime(1082):     ... 11 more

3 Answers

Hey guys, the information on how to fix this bug is and the bottom of the lesson you are watching (under teacher notes). Since Eclipse / the SDK has been update the themes you are trying to use don't work anymore (I have no idea why tho). There's also a post detailing a fix here https://teamtreehouse.com/forum/you-need-to-use-a-themeappcompat-theme-or-descendent-crystal-ball-crashes

Hope this helps!

Thank you! Fixed it and my app is working again.

Same problem was posted by me but still no solution. Team Tree House needs to look into this.

Hello Andrew and Samiruddin,

  1. Have you tried to debug ? (I'm not sure if at this point you already had the debugging part of the course).
  2. Do you guys have any clue after what it started happening ?
  3. Can you paste your code here ? The part you guess you are having the error.
  4. Can you put the link of the exactly lesson that you started to have the problem.

Anyway it's hard to define just with the text trace above but seems to be something with the action bar. PS.: Eclipse has some bugs with the themes.

tks.