我正在尝试将 Firebase 云存储添加到我的应用程序中。下面是应用程序 build.gradle。但它说:无法解决:com.google.firebase:firebase-core:16.0.1。为什么?依赖项中根本没有 firebase-core。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.louise.udacity.mydict"
minSdkVersion 15
targetSdkVersion 27
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.cloud:google-cloud-storage:1.31.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
}
apply plugin: 'com.google.gms.google-services'
原文由 Louise L. 发布,翻译遵循 CC BY-SA 4.0 许可协议
来自文档:-
添加:
并在顶级 gradle 文件中使用最新版本的 google play 服务:
https://firebase.google.com/support/release-notes/android
https://bintray.com/android/android-tools/com.google.gms.google-services
笔记:
您需要在顶级 gradle 文件中添加
google()
存储库,如 firebase 文档中所述,并且它应该在jcenter()
之前:https://firebase.google.com/docs/android/setup