我不想使用v23,我想使用v22。我在任何地方都指定了v22,但是当我尝试同步gradle文件时,我得到:
Error:Failed to resolve: com.android.support:appcompat-v7:23.0.0
Install Repository and sync project
Open File
Show in Project Structure dialog
所以我点击Open File,然后打开app build.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
<snip>
}
}
compileSdkVersion 'Google Inc.:Google APIs:22'
buildToolsVersion '22.0.1'
defaultConfig {
applicationId 'com.global.android.cwa'
minSdkVersion 9
targetSdkVersion 20
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".debug"
}
}
productFlavors {
Pro {
applicationId "com.global.android.pwa"
signingConfig signingConfigs.config
targetSdkVersion 22
}
Simple {
applicationId "com.global.android.swa"
signingConfig signingConfigs.config
targetSdkVersion 22
}
Beta {
applicationId "com.global.android.pwab"
signingConfig signingConfigs.config
targetSdkVersion 22
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
}
如果我选择安装存储库和同步项目,那么我在编译过程中会遇到错误:
android-apt-compiler: [appcompat] D:\Android SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
我可以在外部库中看到它包含appcompat-v23。
有人可以帮助我在gradle中运用恶魔,不断尝试将appcompat v23包含在我的项目中吗?
答案 0 :(得分:1)
您正在使用
compile 'com.google.android.gms:play-services:9.0.0'
此版本has a dependency with support libraries v23.
您必须使用API23进行编译。
compileSdkVersion 23