Gradle同步失败,因为com.firebaseui:firebase-ui-auth:3.2.1无法解析
我正在使用Firebase和Google Play服务的最新依赖项。尝试从Firebase控制台启用登录选项。另外,在应用程序目录下添加了google-services.json。尽管如此,gradle同步上的相同错误
这是应用程序和项目级别的gradle文件:
app / build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.google.firebase.example.fireeats'
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName '1.0'
vectorDrawables.useSupportLibrary true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// Firestore
compile 'com.google.firebase:firebase-firestore:11.8.0'
// Other Firebase/Play services deps
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
// FirebaseUI (for authentication)
compile 'com.firebaseui:firebase-ui-auth:3.2.1'
// ButterKnife (for sample code brevity)
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
// Support Libs
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:animated-vector-drawable:27.0.1'
compile 'com.android.support:cardview-v7:27.0.1'
compile 'com.android.support:customtabs:27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:recyclerview-v7:27.0.1'
// Android architecture components
compile 'android.arch.lifecycle:runtime:1.0.0-alpha9'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha9'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha9'
// Third-party libraries
compile 'me.zhanghai.android.materialratingbar:library:1.0.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
}
apply plugin: 'com.google.gms.google-services'
项目/ build.gradle
//顶层构建文件,您可以在其中添加所有子项目/模块共有的配置选项。
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
google()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
编辑:可以将FirebaseUI版本从3.2.1更改为3.1.3。这是FirebaseUI的github页面-https://github.com/firebase/FirebaseUI-Android,其中列出了FirebaseUI版本与Firebase / Play服务版本。尽管它将FirebaseUI版本3.2.1映射到Firebase / Play服务版本11.8.0,但它对我不起作用。
最佳答案
在你这里
添加此依赖项,
'com.google.firebase:firebase-auth:11.8.0'
compile 'com.firebaseui:firebase-ui-auth:3.1.3'