在将以下行添加到build.gradle文件
后,我的应用级别gradle的同步失败implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
编辑:添加以下行将解决问题
implementation 'com.google.firebase:firebase-core:15.0.2'
它返回以下错误:
Failed to resolve: com.google.firebase:firebase-core:15.1.0
我通过SDK管理器检查了我的Google Play服务,Google存储库和Android支持存储库,该管理器分别具有版本49,58和47.0.0,这些都已更新。
我也尝试添加
implementation 'com.google.firebase:firebase-core:15.1.0'
但它仍会产生相同的错误。
这些是我的一些代码:
build.gradle(app)
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy' //to be able to use HttpClient class
compileSdkVersion 26
defaultConfig {
applicationId "ph.edu.uplb.ics.opruplb"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:15.1.0'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.firebase:firebase-database:15.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
的build.gradle(项目)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:1)
无法解决:com.google.firebase:firebase-core:15.1.0
阅读Firebase Android Release Notes.
您应该设置 firebase-core:15.0.2
implementation 'com.google.firebase:firebase-core:15.0.2'