在make 其中一个module的时候,报appcompat_v7相关的错误,不是资源不存在就是style不存在
module 里面的 build.gradle文件如下
</pre><pre name="code" class="html">apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.testservice"
minSdkVersion 11
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
// java版本
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
检查发现 compleSdkVersion 和 com.android.support:appcompat-v7:22.1.1 版本不一致。
每次新建module的时候 这个 dependecies下面的 com.andorid.support.appcompat-v7:22.1.1 因为我在SDK Manager 已经将Android support Library升级到了22.1.1
经过我验证,appcompat-v7: 22.1.1 必须compileSdkVersion使用android 5.0 ,这里我改成 21 就可以了,
但如果compileSdkVersion 想使用 17,非5.0的,那么 com.android.support:appcompat-v7:19.+ 就可以了。至少要19 ,其它的什么 appcompat-v7:17.+ 都报错。