When trying to extend ActionBarActivity I need to use the AppCompat theme (Theme.AppCompat.Light). When I try to add it in the manifest and styles.xml I get
Error:(31, 28) No resource found that matches the given name (at
'theme' with value '@android:style/Theme.AppCompat.Light').
Eventhough I have downloaded the support libraries and included this in my build.gradle file ->
dependencies {
compile 'com.android.support:appcompat-v7:19.0.+'
compile 'com.android.support:support-v4:19.0.+'}
Best Answer
In Android Studio, I had this same error when using
android:theme='@android:style/Theme.AppCompat.Light
but when I useandroid:theme="@style/Theme.AppCompat.Light"
inside the AndroidManifest.xml file, the error is gone.The difference appears to be from referring to an Android system wide provided theme "@android", to a locally defined theme "@style". Using the locally defined theme works due to having defined the gradle dependency on the appcompat library
compile 'com.android.support:appcompat-v7:19.0.+'
, which is imported as a local theme.For reference, the official documentation from Google for Android Developers around adding the ActionBar on Android devices 2.1+ instructs to use:
android:theme="@style/Theme.AppCompat.Light"
https://developer.android.com/training/basics/actionbar/setting-up.html