我正在尝试从我的firebase存储中获取一些文件url,为此你必须添加依赖项:
compile 'com.google.firebase:firebase-storage:11.0.2'
在app level gradle文件中显示您的应用。我这样做了,但现在我收到了错误:
错误:任务':app:processDebugGoogleServices'执行失败。>请修改版本冲突,方法是更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms版本更新为10.0.1。
我在线查看了问题,我找到的唯一解决方案是我需要添加:
apply plugin: 'com.google.gms.google-services'
到我的app level gradle文件的底部,我已经做了一段时间了。我似乎无法弄清楚导致此错误的原因。
app level gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.lonelygamer.dmc"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
dependencies {
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'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:11.0.2'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:2)
所有Firebase和Google Play服务依赖项的版本必须相同。还建议使用最新版本的支持库:25.4.0。
dependencies {
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'
})
compile 'com.android.support:appcompat-v7:25.4.0' // RECOMMENDED CHANGE
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2' // CHANGED
compile 'com.google.firebase:firebase-database:11.0.2' // CHANGED
compile 'com.google.firebase:firebase-storage:11.0.2'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
testCompile 'junit:junit:4.12'
}
答案 1 :(得分:0)
更新您的SDK,然后使用新的API和Google服务更新构建gradle文件....然后同步gradle