【问题标题】:Android App build fail because of firebase-storage:11.0.2 dependency由于 firebase-storage:11.0.2 依赖,Android App 构建失败
【发布时间】:2017-07-20 19:23:47
【问题描述】:

我正在尝试从我的 firebase 存储中获取一些文件 url,为此您必须添加依赖项:

    compile 'com.google.firebase:firebase-storage:11.0.2'

应用级 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'

到我的应用程序级 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'

【问题讨论】:

  • 发布您的应用模块 build.gradle。所有 Firebase 和 Google Play 服务依赖项的版本必须相同。
  • @BobSnyder 去吧

标签: android firebase firebase-realtime-database dependencies firebase-storage


【解决方案1】:

所有 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'
}

【讨论】:

    【解决方案2】:

    更新您的 SDK,然后使用新的 API 和 Google 服务更新构建 gradle 文件,然后同步 gradle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-13
      • 2017-08-14
      • 2016-01-24
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-14
      相关资源
      最近更新 更多