I created a new project targeting the L preview. The starter activity that the sdk generates extends ActionBarActivity, however, when I try to run the bare-bone generated activity, it throws the following exception:
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:110)
at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:99)
I've looked around but Theme.AppCompat.Material
doesn't seem to exist. How do I make ActionBarActivity to take advantage of the new Material themes?
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.sdchang.example'
minSdkVersion 'L'
targetSdkVersion 'L'
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.mcxiaoke.volley:library:1.0.+@aar'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.squareup.okhttp:okhttp:2.0.+'
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…