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 Build a Simple Android App (retired 2014) Pretty Little Things Adding an Image

David Vaks
David Vaks
1,032 Points

"Unfortunately CrystalBall has stopped"

Hi, I made some changes before this "Adding an Image" video, so each time I press the button, I also get a random background color of the RelatedLayout. After adding an image and following this video I get an "Unfortunately CrystalBall has Stopped" message from my Genymotion emulator. Plz Help!

Thanks!

6 Answers

Yes - the Theme does cause problems in later versions! We've all been there!!

Glad you're sorted.

Steve.

Can you post the content of LogCat - the answer will probably lie in there somewhere!

I had a few instances of this happening - have you done Project | Clean ... that might help.

Steve.

David Vaks
David Vaks
1,032 Points

Thanks. I tried Project | Clean but it didn't help. I'm new to this... Here's the log, It's a little long...

06-11 12:01:52.145: D/AndroidRuntime(1411): Shutting down VM 06-11 12:01:52.145: W/dalvikvm(1411): threadid=1: thread exiting with uncaught exception (group=0xa4d00b20) 06-11 12:01:52.161: E/AndroidRuntime(1411): FATAL EXCEPTION: main 06-11 12:01:52.161: E/AndroidRuntime(1411): Process: com.example.crystalball, PID: 1411 06-11 12:01:52.161: E/AndroidRuntime(1411): 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. 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.ActivityThread.access$800(ActivityThread.java:135) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.os.Handler.dispatchMessage(Handler.java:102) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.os.Looper.loop(Looper.java:136) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-11 12:01:52.161: E/AndroidRuntime(1411): at java.lang.reflect.Method.invokeNative(Native Method) 06-11 12:01:52.161: E/AndroidRuntime(1411): at java.lang.reflect.Method.invoke(Method.java:515) 06-11 12:01:52.161: E/AndroidRuntime(1411): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 06-11 12:01:52.161: E/AndroidRuntime(1411): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 06-11 12:01:52.161: E/AndroidRuntime(1411): at dalvik.system.NativeStart.main(Native Method) 06-11 12:01:52.161: E/AndroidRuntime(1411): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 06-11 12:01:52.161: E/AndroidRuntime(1411): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:19) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.Activity.performCreate(Activity.java:5231) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 06-11 12:01:52.161: E/AndroidRuntime(1411): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 06-11 12:01:52.161: E/AndroidRuntime(1411): ... 11 more 06-11 12:01:59.517: I/Process(1411): Sending signal. PID: 1411 SIG: 9

That looks like the Theme is set incorrectly. I'm not sure about how to fix that (assuming I'm right!). Do you have appcompat_v7` at the top of your Package Explorer folder list?

Steve.

What's on line 19 of your MainActivity?

com.example.crystalball.MainActivity.onCreate(MainActivity.java:19```
David Vaks
David Vaks
1,032 Points

Oh! man thanks for your time! I've noticed there was a known issue about that, because of an update of the Android Tools. I've followed the "Known Issues" below the video, and it worked. I guess the main problem was changing the theme to Theme.Black.NoTitleBar.Fullscreen instead of appTheme