【发布时间】:2016-02-07 22:26:19
【问题描述】:
我正在点击此链接将 Google 登录功能集成到我的 Android 应用中。https://developers.google.com/identity/sign-in/android/start-integrating 正如上面给定页面的最后一步中给出的,我们必须包含依赖项
compile 'com.google.android.gms:play-services-auth:8.3.0'
在应用程序级 build.gradle 文件中,但这样做并构建项目时出现错误提示
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.brainbreaker.socialbuttons"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
}
在 build.gradle 文件中编译依赖行 compile 'com.google.android.gms:play-services-auth:8.3.0' 显示错误
所有 com.google.android.gms 库必须使用完全相同的版本 规范(混合版本可能导致运行时崩溃)。成立 版本 8.3.0、8.1.0。例子包括 com.google.android.gms:play-services-base:8.3.0 和 com.google.android.gms:play-services-measurement:8.1.0 有一些 库或工具和库的组合,它们是 不兼容,或者可能导致错误。一种这样的不兼容性是 使用不支持的 Android 支持库版本进行编译 最新版本(或者特别是低于您的 targetSdkVersion。)
这是 gradle build 的消息。
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :social_buttons:generateDebugSources, :social_buttons:generateDebugAndroidTestSources, :social_buttons:compileDebugSources, :social_buttons:compileDebugAndroidTestSources]
:clean UP-TO-DATE
:app:clean
:social_buttons:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Information:BUILD FAILED
Information:Total time: 3.49 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
我看不到任何解决此版本冲突的方法。任何帮助表示赞赏。
【问题讨论】:
-
请检查 play-services 9.4.0 是否仍然存在此问题。我相信他们修复了这个错误。
-
new android studio(2.3) 给了我这个错误。尽管我已经尝试了所有答案,但错误仍然存在
-
每次 Gradle 升级都会导致问题 :(
标签: android gradle build.gradle