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

Joseph Mejorada
Joseph Mejorada
2,939 Points

Crystall Ball App errors after adding image

At the end of the lesson "Adding an Image" in the "Pretty Little Things" section, I am getting the following errors in activity_main.xml:

[Accessibility] Missing contentDescription attribute on image [I18N] Hardcoded string "Enlighten me!", should use @string resource

4 Answers

Thanks Ben. I actually decided to just start creating the app from scratch. When I got to the pretty little things section, I paused the video, did the work around then rewatched the lesson. It was a bittersweet experience. While I didn't learn how to fix this exact problem, I did get to review what I had learned up to this point, and caught on to some things I had missed!

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi Joseph,

Those are warnings that are safe to ignore. Warnings are exactly that: warnings about things that should be fixed but that won't stop your app. It's a good practice to fix warnings, too, but we simply skipped it for this project in the interests of time. We do talk about @string resources in the 2nd project.

The contentDescription is a separate attribute that is used for accessibility, like alt text for images on the web.

Julie Foster
Julie Foster
2,008 Points

I'm getting the same errors but it won't let me run my program :/

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Can you paste in the errors you are seeing? Check the Console and Logcat tabs in Eclipse.

05-11 23:18:13.435: E/AndroidRuntime(2256): FATAL EXCEPTION: main 05-11 23:18:13.435: E/AndroidRuntime(2256): 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-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.ActivityThread.access$600(ActivityThread.java:141) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.os.Handler.dispatchMessage(Handler.java:99) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.os.Looper.loop(Looper.java:137) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.ActivityThread.main(ActivityThread.java:5103) 05-11 23:18:13.435: E/AndroidRuntime(2256): at java.lang.reflect.Method.invokeNative(Native Method) 05-11 23:18:13.435: E/AndroidRuntime(2256): at java.lang.reflect.Method.invoke(Method.java:525) 05-11 23:18:13.435: E/AndroidRuntime(2256): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 05-11 23:18:13.435: E/AndroidRuntime(2256): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 05-11 23:18:13.435: E/AndroidRuntime(2256): at dalvik.system.NativeStart.main(Native Method) 05-11 23:18:13.435: E/AndroidRuntime(2256): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 05-11 23:18:13.435: E/AndroidRuntime(2256): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:17) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.Activity.performCreate(Activity.java:5133) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 05-11 23:18:13.435: E/AndroidRuntime(2256): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175) 05-11 23:18:13.435: E/AndroidRuntime(2256): ... 11 more

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Sorry for this trouble! There is a known issue caused by a recent update to the tools. Check the Teacher's Notes for how to work around this: http://teamtreehouse.com/library/build-a-simple-android-app/pretty-little-things/adding-an-image-2