簡體   English   中英

Android應用程序構建由於firebase-storage:11.0.2依賴關系而失敗

[英]Android App build fail because of firebase-storage:11.0.2 dependency

我正在嘗試從我的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文件的底部,這已經有一段時間了。 我似乎無法弄清楚是什么原因導致此錯誤。

應用程序級別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'

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

更新您的SDK,然后在以下位置使用新的API和Google服務更新構建gradle文件:...然后同步gradle

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM