【发布时间】:2017-12-21 06:25:06
【问题描述】:
使用 firebase 实现 Google 登录。
这是我的项目级 build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的 App 级 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
defaultConfig {
applicationId "wallet.mycoin"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
}
在构建时,我遇到了类似 >
的错误错误:任务 ':app:processDebugGoogleServices' 执行失败。 请通过更新版本来修复版本冲突 google-services 插件(有关最新版本的信息是 可在 https://bintray.com/android/android-tools/com.google.gms.google-services/) 或将 com.google.android.gms 的版本更新为 9.0.0。
和
所有 firebase/gms 库必须使用完全相同的规范 (混合版本会导致运行时崩溃)找到版本 9.0.0 和 11.8.0。例子包括 com.google.firebase:firebase-analytics:9.0.0 和 com.google.android.gms:play-services-auth:11.8.0.
有一些库或工具和库的组合 不兼容,或者可能导致错误。一种这样的不兼容 使用不是 最新版本(或特定版本低于 targetSdkVersion)
项目中没有添加任何 Firebase 分析库。任何人都可以提出解决方案。构建失败。
【问题讨论】:
标签: android firebase firebase-authentication build.gradle