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 (2014) Creating the Screen Layout Using a Fullscreen Theme

Thamood Binmahfooz
Thamood Binmahfooz
3,283 Points

app keeps crashing on the emulator after changing the theme

after i changed the theme to:

<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">

and running it on the emulator i kept getting this runtime error:

You need to use a Theme.AppCompat theme (or descendant) with this activity.

after looking around i found this on stack overflow:

http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity

so i changed the the Java file to extends the Activity class instead of the ActionBarActivity class and all went well.

i don't know if what i did was correct.

I'm using Android Studio 1.0.2 on a Mac

4 Answers

Easy fix, I ran into the same problem just now and decided I better share the solution. ^_^

Inside AndroidManifest.xml there is a line that says android:theme this is just calling a style from your styles.xml. So if we open up this file and change the theme to look like the following everything should work splendidly.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

Thank you dear Sir! Worked like charm.

Miguel Sousa
Miguel Sousa
6,872 Points

It worked with me!

Yep this worked, Great stuff.

I tried this as well as all the suggested tips in the forum but it still doesn't work. It "runs" without errors but when it shows up on the emulator or my phone it immediately crashes

Charles Herrera
Charles Herrera
3,292 Points

I had the same issue

I had to change the java to public class FunFactsActivity extends android.app.Activity

It would be nice to get someone from Treehouse to address what is going on here

Rex Wang
Rex Wang
2,089 Points

I changed mine to AppCompatActivity as recommended by this S.O. post

kaizen rework
kaizen rework
810 Points

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> -- this worked for me :)

thank you