我开始使用 Android 开发并尝试在 Android L 上使用测试应用程序。
我希望能够在 Android L 模拟器上加载材料设计主题,并在我的 Android 4.4 模拟器上加载标准全息主题。我真的无法让它运行。
当我尝试运行该应用程序时,出现此错误:
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>
另一个在 values-v21 中:
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Customize your theme here. -->
</style>
我究竟做错了什么?