Jorge Cunha
Jorge Cunha

Reputation: 83

Android style app minSdkVersion="8" targetSdkVersion="21"

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?

Upvotes: 1

Views: 244

Answers (1)

manDroid
manDroid

Reputation: 1135

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.

Upvotes: 2

Related Questions