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 trialmohsinmumtaz
729 PointsCrystal Ball launch Problem
When i click run on eclipse its showing me this message in Genymotion emulator "Unfortunately Crystal Ball has stopped "
help!
2 Answers
Ernest Grzybowski
Treehouse Project ReviewerIt seems like you're getting some sort of runtime error. Please post the error message from logcat. Usually when your application crashes, logcat will show up on the lower portion of whichever IDE you are using (Android Studio or Eclipse).
Here's how to find logcat in Eclipse: http://stackoverflow.com/questions/12769798/how-to-open-logcat-in-eclipse-for-android-debug
and for Android Studio: http://stackoverflow.com/questions/16817566/logcat-is-gone-on-android-studio
Just copy the error (usually a red color) just after the crash happens and edit your question. That will help us come up with a solution.
Gergő Bogdán
6,664 PointsPlease take a look at the DBMS window in Eclispe. Most probably your application has crashed and you have an error message there (written in red). Please add that to the forum thread, otherwise we cannot really help, we know too less to identify the issue.
mohsinmumtaz
729 Pointsmohsinmumtaz
729 PointsThis is happening only after i add a CrystalBall image.
I tried just before adding image and it worked fine
I'm using Genymotion emulator
Ernest Grzybowski
Treehouse Project ReviewerErnest Grzybowski
Treehouse Project ReviewerPlease post the error you are getting from logcat. There are a million and one ways that this could go wrong.
mohsinmumtaz
729 Pointsmohsinmumtaz
729 Points08-19 17:45:49.705: D/AndroidRuntime(1895): Shutting down VM 08-19 17:45:49.705: W/dalvikvm(1895): threadid=1: thread exiting with uncaught exception (group=0xa4d2db20) 08-19 17:45:49.717: E/AndroidRuntime(1895): FATAL EXCEPTION: main 08-19 17:45:49.717: E/AndroidRuntime(1895): Process: com.example.crystalball, PID: 1895 08-19 17:45:49.717: E/AndroidRuntime(1895): 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. 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.ActivityThread.access$800(ActivityThread.java:135) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.os.Handler.dispatchMessage(Handler.java:102) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.os.Looper.loop(Looper.java:136) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.ActivityThread.main(ActivityThread.java:5017) 08-19 17:45:49.717: E/AndroidRuntime(1895): at java.lang.reflect.Method.invokeNative(Native Method) 08-19 17:45:49.717: E/AndroidRuntime(1895): at java.lang.reflect.Method.invoke(Method.java:515) 08-19 17:45:49.717: E/AndroidRuntime(1895): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 08-19 17:45:49.717: E/AndroidRuntime(1895): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 08-19 17:45:49.717: E/AndroidRuntime(1895): at dalvik.system.NativeStart.main(Native Method) 08-19 17:45:49.717: E/AndroidRuntime(1895): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 08-19 17:45:49.717: E/AndroidRuntime(1895): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:16) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.Activity.performCreate(Activity.java:5231) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 08-19 17:45:49.717: E/AndroidRuntime(1895): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 08-19 17:45:49.717: E/AndroidRuntime(1895): ... 11 more
mohsinmumtaz
729 Pointsmohsinmumtaz
729 PointsThis is what its showing.. i don't knpw
Ernest Grzybowski
Treehouse Project ReviewerErnest Grzybowski
Treehouse Project ReviewerThe error seems to be that it can't start the activity because "You need to use a Theme.AppCompat theme (or descendant) with this activity." Post your application manifest for us to take a look at.
mohsinmumtaz
729 Pointsmohsinmumtaz
729 Points<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.crystalball" android:versionCode="1" android:versionName="1.0" >
</manifest>
"WHEN I CHANGE TO APP COMPAT THEME ITS WORKING FINE BUT I WANT THE THEME WHICH I POSTED IN THE ABOVE CODE ". WHAT SHOULD I DO??
Ernest Grzybowski
Treehouse Project ReviewerErnest Grzybowski
Treehouse Project Reviewerandroid:theme="@android:style/Theme.DeviceDefault.Dialog.NoActionBar" is a Dialog theme. You can change it to a bunch of different themes but not a dialog theme. That's your answer! As the error said "You need to use a Theme.appcompat" variant. What is your MainActivity extending?