Android Can';t为min=targetSdkVersion=10的应用程序添加支持库

Android Can';t为min=targetSdkVersion=10的应用程序添加支持库,android,gradle,android-studio,android-support-library,Android,Gradle,Android Studio,Android Support Library,我正在尝试将Android支持库(appcompat)添加到空项目中,该项目仅分配用于API级别10 因此,我使用以下选项创建Android Studio项目 然后在依赖项区域中添加支持库 buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply pl

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

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

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

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'.
...

由于在项目中使用了Android 3.0+中的资源,
'Android:Theme.Holo'
,因此出现错误

只需将targetSDKVersion设置为>11。


尝试将目标SDK和编译更改为4.3(API级别18)@lassana,是的,这是可行的。但是为什么我不能对API级别10执行同样的操作呢?有什么问题吗?如果minSDKVersion=10,您的应用程序必须在2.3版本上运行。您应该始终设置targetSDk最大值。@拉萨纳,这在实践中不是问题。但我想了解为什么
gradle
生成的文件对指定的目标版本无效。这是否意味着
gradle
中存在缺陷,如果我想限制使用maxSdkVersion=10的应用程序,就无法构建项目?