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 Build a Simple Android App (retired 2014) Pretty Little Things Customizing Buttons and Labels

Cant run the app on the AVD after this

After taking the directions on this video I cant run the project on my AVD anymore, the logcat file says this:

"07-13 02:00:11.104: E/AndroidRuntime(1107): FATAL EXCEPTION: main 07-13 02:00:11.104: E/AndroidRuntime(1107): Process: com.treehouse.crystallball, PID: 1107 07-13 02:00:11.104: E/AndroidRuntime(1107): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.treehouse.crystallball/com.treehouse.crystallball.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity." among other stuff, is there a way to solve this? I'm pretty sure I messed up while following the instructions, but I cant find a solution

Thank you in advance for the help you can provide

1 Answer

Here is what you need to do

The error relates to java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

The video in treehouse uses the Theme called ** Theme.Black.NoTitleBar.Fullscreen ** . Are you using this?

If yes, then the new android update no longer supports this. However there is a work around as proposed by treehouse


1) Change your project back to using "AppTheme" like it was before in AndroidManifest.xml and the preview.

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"

4) Change MainActivity to extend Activity, not ActionBarActivity


Hope this helps. Ask again if you have doubts.