Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android exception: You need to use a Theme.AppCompat theme with this activity

Tags:

android

In order to use the support action bar, my activity has to extend ActionBarActivity, and when I do that and start the activity, the application crashes with:

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

In my styles.xml I have

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

And in my AndroidManifest.xml for the offending activity I have

<activity android:name="com.example.test3.SettingsActivity"
          android:theme="@style/AppBaseTheme" />
like image 593
PFort Avatar asked Sep 12 '13 12:09

PFort


People also ask

How to set AppCompat theme?

All you need to do is add android:theme="@style/Theme. AppCompat. Light" to your application tag in the AndroidManifest. xml file.

What is AppCompat?

426. An Android support library that enables the use of the ActionBar and Material Design specific implementations such as Toolbar for older devices down to Android v2.


1 Answers

You have to check for other folders, that contain styles files as well, that could possibly override your styles.

like image 51
Ahmad Avatar answered Sep 21 '22 15:09

Ahmad