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

Samiruddin Syed
Samiruddin Syed
3,136 Points

System not responding (Crystal Ball) and Emulator says unfortunately Crystal Ball has stopped.

im new to Tree house, i started the Android project, little things chapter, after i make the background image and then set it at the background, and when the app is run, the emulator says "Unfortunately Crystal Ball has stopped" , whereas i have done exactly what was shown in the video and nothing extra or less. There's no solution posted about that here. kindly help.

10 Answers

Masum Bergmann
PLUS
Masum Bergmann
Courses Plus Student 4,129 Points

That's the problem... you should change your theme back to the original "AppTheme"... as instructed in point 1 of the solution!

You should have

android:theme="@style/AppTheme"
william parrish
william parrish
13,774 Points

Are you familiar with logging and or the logcat feature? When your app fails like that, there will be a line by line log readout, that explains or gives insight into what went wrong, and maybe even on the line of code that it happened.

"unfortunately crystal ball has stopped" is sort of just a generic error message, its a tough task to tell you what went wrong without more detailed log information.

Samiruddin Syed
Samiruddin Syed
3,136 Points

sure, i know logcat, here is what appears in Logcat :

05-03 11:38:18.023: D/AndroidRuntime(1150): Shutting down VM
05-03 11:38:18.023: W/dalvikvm(1150): threadid=1: thread exiting with uncaught exception (group=0xb1ae1ba8)
05-03 11:38:18.073: E/AndroidRuntime(1150): FATAL EXCEPTION: main
05-03 11:38:18.073: E/AndroidRuntime(1150): Process: com.example.crystalball, PID: 1150
05-03 11:38:18.073: E/AndroidRuntime(1150): 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.
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.os.Handler.dispatchMessage(Handler.java:102)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.os.Looper.loop(Looper.java:136)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.ActivityThread.main(ActivityThread.java:5017)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at java.lang.reflect.Method.invokeNative(Native Method)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at java.lang.reflect.Method.invoke(Method.java:515)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at dalvik.system.NativeStart.main(Native Method)
05-03 11:38:18.073: E/AndroidRuntime(1150): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at com.example.crystalball.MainActivity.onCreate(MainActivity.java:15)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.Activity.performCreate(Activity.java:5231)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-03 11:38:18.073: E/AndroidRuntime(1150):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-03 11:38:18.073: E/AndroidRuntime(1150):     ... 11 more
Masum Bergmann
PLUS
Masum Bergmann
Courses Plus Student 4,129 Points

Did the crash occur AFTER you changed the theme? If YES, then it's a known issue... The fix is described in the Teacher's Notes below the video! (If I'm not mistaken it's the first video in Pretty Little Things!)

Samiruddin Syed
Samiruddin Syed
3,136 Points

yes it happened after i changed the theme. and yes you are right about the video.

Masum Bergmann
PLUS
Masum Bergmann
Courses Plus Student 4,129 Points

Ok, so it's an issue with the ol' NoTitleBar... here are the steps to fix it:

1) Change your project back to using "AppTheme" like it was before.

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"
Samiruddin Syed
Samiruddin Syed
3,136 Points

I've done what all you wrote here, but there is no change. the App still doesn't run and still the "Unfortunately Crystal Ball stopped" pops up. There should be some way around this.

Samiruddin Syed
Samiruddin Syed
3,136 Points

and one more thing which is new in the emulator is when ever I start the AVD, thers a popup which says "Process system not responding" and there are 2 options - Wait and Ok. This had never come up before this theme tutorial before.

Samiruddin Syed
Samiruddin Syed
3,136 Points

Masum Bergmann 05-03 13:49:41.237: E/AndroidRuntime(1138): ... 11 more 05-03 13:49:51.627: I/Process(1138): Sending signal. PID: 1138 SIG: 9

Masum Bergmann
PLUS
Masum Bergmann
Courses Plus Student 4,129 Points

hmm... Are you using an emulator from Genymotion? If not, try installing Genymotion (http://www.genymotion.com/), that should take care of your emulator worries for now. Sometimes it's also enough to close everything and restart the system

What does android:theme= equal to in your AndroidManifest.xml?

Samiruddin Syed
Samiruddin Syed
3,136 Points

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

Samiruddin Syed
Samiruddin Syed
3,136 Points

Got it !!! Masum Bergmann you are awesome !!! Thanks Alottttt.