1

I'm creating an app with minSdkVersion="8" and targetSdkVersion="21"

In AndroidManifest I have:

android:theme="@style/AppTheme"

in the file styles.xml:

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

in the file values-v11/styles.xml:

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">

in the file values-v14/styles.xml:

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">

The Activity extends to ActionBarActivity

When I run the app I get this error:

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

What i need to do to have an app running well?

Pooja
  • 2,417
  • 20
  • 39
  • possible duplicate of [ActionBarCompat: java.lang.IllegalStateException: You need to use a Theme.AppCompat](http://stackoverflow.com/questions/18063395/actionbarcompat-java-lang-illegalstateexception-you-need-to-use-a-theme-appcom) – Kunu Apr 29 '15 at 10:47
  • possible duplicate of [You need to use a Theme.AppCompat theme (or descendant) with this activity](http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity) – Pooja Apr 29 '15 at 11:38

1 Answers1

2

The reason you are having this problem is because the Activity you are extending ActionBarActivity which requires the AppCompat theme to be applied.

Change the Java inheritance from ActionBarActivity to Activity.

Pooja
  • 2,417
  • 20
  • 39
manDroid
  • 1,125
  • 3
  • 13
  • 25