我开始使用Android开发,并试图在Android L上使用测试应用程序。
我希望能够在Android L模拟器上加载材质设计主题,并在我的Android 4.4模拟器上加载标准的holo主题。我真的无法让它运行。
当我尝试运行应用程序时,我收到此错误:
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
我的gradle文件是这样的:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.blitzcomputerservices.equinehealth'
versionCode 1
versionName '1.0'
}
productFlavors {
l {
minSdkVersion 'android-L'
targetSdkVersion 'L'
compileSdkVersion 'android-L'
}
old {
minSdkVersion 16
targetSdkVersion 20
//TODO comment second line if build is not compiles for "L"
compileSdkVersion 20
}
}
}
dependencies {
compile 'com.koushikdutta.ion:ion:1.1.5'
compile 'com.soundcloud.android:android-crop:0.9.9@aar'
/*lCompile 'com.android.support:appcompat-v7:21.+'
oldCompile 'com.android.support:appcompat-v7:19.1.0'*/
}
清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.blitzcomputerservices.equinehealth">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.blitzcomputerservices.equinehealth.EquineHealthActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.blitzcomputerservices.equinehealth.HorseDetails"
android:parentActivityName="com.blitzcomputerservices.equinehealth.EquineHealthActivity"
android:label="@string/title_activity_horse_details" >
</activity>
<activity android:name="com.soundcloud.android.crop.CropImageActivity" />
</application>
我有两个styles.xml
个文件:
values
中的一个:
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
和另一个在值-v21中:
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Customize your theme here. -->
</style>
我做错了什么?
答案 0 :(得分:0)
和另一个在值-v21中:
L预览是API 20,而不是v21