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
Samuel Cressman
401 PointsAdding An Image Problem: Build a Simple Android App
Dear all,
I am having trouble adding an image. When I try to run my app, I receive this error message:
06-25 12:36:39.516: E/AndroidRuntime(1115): FATAL EXCEPTION: main 06-25 12:36:39.516: E/AndroidRuntime(1115): Process: com.example.crystalball, PID: 1115 06-25 12:36:39.516: E/AndroidRuntime(1115): 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-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.ActivityThread.access$800(ActivityThread.java:135) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.os.Handler.dispatchMessage(Handler.java:102) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.os.Looper.loop(Looper.java:136) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-25 12:36:39.516: E/AndroidRuntime(1115): at java.lang.reflect.Method.invokeNative(Native Method) 06-25 12:36:39.516: E/AndroidRuntime(1115): at java.lang.reflect.Method.invoke(Method.java:515) 06-25 12:36:39.516: E/AndroidRuntime(1115): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 06-25 12:36:39.516: E/AndroidRuntime(1115): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 06-25 12:36:39.516: E/AndroidRuntime(1115): at dalvik.system.NativeStart.main(Native Method) 06-25 12:36:39.516: E/AndroidRuntime(1115): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 06-25 12:36:39.516: E/AndroidRuntime(1115): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:24) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.Activity.performCreate(Activity.java:5231) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 06-25 12:36:39.516: E/AndroidRuntime(1115): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 06-25 12:36:39.516: E/AndroidRuntime(1115): ... 11 more
I am very confused. The only place I think that a problem might have occurred is the use of the image. I initially changed the image name from ball01 to CrystalBall_Image, which is not allowed, so I went back and replaced my CrystalBall_Image with ball01.
Thank you very much, and any help is greatly appreciated,
Sam
Update: I noticed on the Adding an Image page the Known Issues under Teacher's Notes. As a result, I replaced my style and activity main with the downloadable versions. However, the app still will not run, and I still receive the same error message as above.
Samuel Cressman
401 PointsSamuel Cressman
401 PointsProblem solved. I did not change my main activity to extend Activity.