migellal
migellal

Reputation: 43

android Theme.Holo.Light.DarkActionBar on lollipop

I create new project (api14-api21) in android studio 1.02. I change 1 line, from:

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

in styles.xml to:

<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">

and i have this:

Process: pl.xxx.myapplication, PID: 5433
java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.xxx.myapplication/pl.xxx.myapplication.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)

It's possible to fix this? I would like to use Theme.Holo.

Upvotes: 2

Views: 2928

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006664

If you are not going to use appcompat-v7 and Theme.AppCompat, you need to:

  • inherit from Activity (or, really, anything other than ActionBarActivity)

  • change any menu resources to use android: instead of app: for things like android:showAsAction

in addition to changing your theme, as you did.

To be safe, and to reduce the size of your APK, you can also get rid of the dependency on appcompat-v7 from your app module's build.gradle file.

Upvotes: 3

Related Questions