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 trialAlo Gutierrez
Courses Plus Student 3,345 PointsCrystalBall crashing after adding the image and changing the Theme ?
Hey guys, I just finished the "Customizing Buttons and Text" video on the Simple Android App and my "Crystal Ball" app crashes. Up to this point everything has been working fine. I added the background image and changed the theme in the AndroidManifest.xml file, but when I run it, the app crashes when trying to be opened.
I dont have any problems but I do have 3 warnings:
Description Resource Path Location Type
[Accessibility] Empty contentDescription attribute on image activity_main.xml /CrystalBall/res/layout line 17 Android Lint Problem [I18N] Hardcoded string "Enlighten me!", should use @string resource activity_main.xml /CrystalBall/res/layout line 37 Android Lint Problem [I18N] Hardcoded string "TODO", should use @string resource activity_main.xml /CrystalBall/res/layout line 17 Android Lint Problem
Below is my Log Cat. Thank you for your help and please let me know if I need to clarify my question!!
- Alonso
2 Answers
Erin Kabbash
5,210 PointsThe warnings you are getting about the strings shouldn't matter, they are simply suggestions by eclipse to use the strings.xml file instead of hard coding your strings. So that is not the issue..
I think it has something to do with the "java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity." error in LogCat. Checkout this link and see if it is helpful: http://stackoverflow.com/questions/18063395/actionbarcompat-java-lang-illegalstateexception-you-need-to-use-a-theme-appcom
I am still learning so I maybe way off base but hopefully it can help shed some light while you wait for a Java master to reply :)
Alo Gutierrez
Courses Plus Student 3,345 PointsThank you I figured it out.
The issue was that modifying AndroidManifest.xml to change the Theme is not accepted by android anymore. I followed the steps at the bottom of the video and everything worked. Thanks again!
Erin Kabbash
5,210 PointsAwesome!
Alo Gutierrez
Courses Plus Student 3,345 PointsAlo Gutierrez
Courses Plus Student 3,345 PointsLog Cat:
06-04 20:23:01.042: D/AndroidRuntime(1034): Shutting down VM 06-04 20:23:01.042: W/dalvikvm(1034): threadid=1: thread exiting with uncaught exception (group=0xb1ad9ba8) 06-04 20:23:01.102: E/AndroidRuntime(1034): FATAL EXCEPTION: main 06-04 20:23:01.102: E/AndroidRuntime(1034): Process: com.example.crystalball, PID: 1034 06-04 20:23:01.102: E/AndroidRuntime(1034): 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-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.ActivityThread.access$800(ActivityThread.java:135) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.os.Handler.dispatchMessage(Handler.java:102) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.os.Looper.loop(Looper.java:136) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-04 20:23:01.102: E/AndroidRuntime(1034): at java.lang.reflect.Method.invokeNative(Native Method) 06-04 20:23:01.102: E/AndroidRuntime(1034): at java.lang.reflect.Method.invoke(Method.java:515) 06-04 20:23:01.102: E/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 06-04 20:23:01.102: E/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 06-04 20:23:01.102: E/AndroidRuntime(1034): at dalvik.system.NativeStart.main(Native Method) 06-04 20:23:01.102: E/AndroidRuntime(1034): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 06-04 20:23:01.102: E/AndroidRuntime(1034): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:19) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.Activity.performCreate(Activity.java:5231) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 06-04 20:23:01.102: E/AndroidRuntime(1034): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 06-04 20:23:01.102: E/AndroidRuntime(1034): ... 11 more 06-04 20:23:11.972: I/Process(1034): Sending signal. PID: 1034 SIG: 9
I hope this helps?