无法为min = targetSdkVersion = 10的应用添加支持库

时间:2013-09-27 12:52:41

标签: android gradle android-studio android-support-library

我尝试将Android支持库(appcompat)添加到空项目中,该项目仅分配用于API级别10。

因此,我使用以下选项创建Android Studio项目。

enter image description here

然后我在依赖项区域添加支持库。

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 10
    buildToolsVersion "18.0.1"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 10
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.0'
}

然后我得到以下编译错误

MyAppProject/MyApp/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/values-v14/values.xml
    Gradle: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Holo.SearchResult.Subtitle'.
    Gradle: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Holo.SearchResult.Title'.
    Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Large'.
    ...

MyAppProject/MyApp/build/exploded-bundles/ComAndroidSupportAppcompatV71800.aar/res/values-v11/values.xml
    Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
    Gradle: No resource found that matches the given name: attr 'android:windowActionBar'.
...

1 个答案:

答案 0 :(得分:1)

您收到错误是因为您在项目中使用了Android 3.0+中的资源:'android:Theme.Holo'

只需设置targetSDKVersion> 11。 enter image description here

Undersanding min/targetSdkVersion