【发布时间】:2017-07-01 16:54:43
【问题描述】:
我使用的是 Android Studio 2.3.3。我尝试在我的应用中使用 Firebase 实时身份验证,但出现此错误:
错误:任务 ':app:processDebugGoogleServices' 执行失败。
请通过更新 google-services 插件的版本(有关最新版本的信息可在 https://bintray.com/android/android-tools/com.google.gms.google-services/ 获得)或将 com.google.android.gms 的版本更新到 10.2.0 来解决版本冲突。
我的项目毕业:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的模块毕业:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "com.ccnstudent.hridoychandradas.ccnapp"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.google.android.gms:play-services-auth:11.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:11.0.2'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
遵循此答案中的示例:stackoverflow.com/a/44508542/4815718 与
SUPPORT_LIB_VER = '25.4.0'和GOOGLE_LIB_VER = '11.0.2'。此外,您不应包含所有 Play 服务:com.google.android.gms:play-services:11.0.2。最好只包含您需要的 API。看到这个答案:stackoverflow.com/a/43743746/4815718