无法解决:com.google.firebase:firebase-storage-common:11.0.1

时间:2017-06-23 13:44:52

标签: android firebase gradle firebase-storage

我正在升级我的Android Studio,Gradle版本2.3到2.3.3,还更新了我的sdk - API级别26,SDK构建工具26,Google Play服务41,Google Repository 54.

当我清理项目时,我收到此错误:Failed to resolve: com.google.firebase:firebase-storage-common:11.0.1

的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 26
        multiDexEnabled = true
    }

    def applicationVersion = '1.524 20170612'

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "2g"
    }

    ...


    useLibrary 'org.apache.http.legacy'
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'build.gradle'
        exclude 'build.xml'
        exclude 'META-INF/jersey-module-version'
        exclude 'META-INF/NOTICE'
    }
    allprojects {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:deprecation"
        }
    }
}

dependencies {

    compile 'com.fasterxml.jackson.core:jackson-core:2.9.0.pr1'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.0.pr1'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr1'
    compile 'com.android.support:multidex:1.0.1'

    compile 'com.google.android.gms:play-services:11.0.1'
    compile 'com.google.android.gms:play-services-base:11.0.1'
    compile 'com.google.android.gms:play-services-appindexing:9.8.0'
    compile 'com.google.android.gms:play-services-contextmanager:9.4.0'
    compile 'com.google.android.gms:play-services-places:11.0.1'
    compile 'com.google.android.gms:play-services-nearby:11.0.1'
    compile 'com.google.android.gms:play-services-maps:11.0.1'
    compile 'com.google.android.gms:play-services-ads:11.0.1'
    compile 'com.google.android.gms:play-services-auth:11.0.1'
    compile 'com.google.android.gms:play-services-gcm:11.0.1'
    compile 'com.google.android.gms:play-services-analytics:11.0.1'
    compile 'com.google.android.gms:play-services-location:11.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.4'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.journeyapps:zxing-android-embedded:3.3.0@aar'
    compile 'com.google.firebase:firebase-messaging:11.0.1'
    compile 'com.google.firebase:firebase-core:11.0.1'
    compile 'com.google.firebase:firebase-analytics:11.0.1'

    compile 'com.flurry.android:analytics:6.4.2'
    compile 'com.android.support.constraint:constraint-layout:+'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

4 个答案:

答案 0 :(得分:7)

Firebase doc说:

  

获得&#34;找不到&#34;错误?确保你有   Android SDK管理器中的最新Google Repository

您可以查看您的Google Repository版本(在Linux中):

enter image description here

答案 1 :(得分:3)

确保群组com.google.android.gms和群组com.google.firebase的版本相同。

例如,当前的最新版本是11.0.1,因此来自com.google.android.gmscom.google.firebase的所有依赖项都应具有版本11.0.1。在您的dependencies列表中,以下两个版本具有不同的版本。确保它们也有版本11.0.1。

为实现这个目标

您需要迁移 播放服务应用程序索引到Firebase应用程序索引。该指南为here

根据Google Awareness API v9.6 is missing上下文管理员,api已更改为Awareness API。因此,您还需要相应地更新代码。

答案 2 :(得分:2)

解决此问题的最佳方法是不使用将firebase链接到您的应用的手动方法。

我已经尝试通过参考这个来添加最新的firebase repo     Link

显示错误&#34;无法解决依赖关系&#34;

FireBase建议在FireBase Assistant for Android Studio 2.2及更高版本的帮助下为您的应用添加firebase。手动将最新库添加到build-gradle(模块)会导致上述错误。

使用Firebase助手非常简单,只需两步即可完成。作为参考,您可以使用&#34;使用Firebase助手&#34;上面提到的同一个链接部分。

它真的与我的Android Studio 2.3.3一起使用

答案 3 :(得分:1)

由于在GooglePlayService包中发生了一些更改,因此抛出此错误。他们将一些类文件和方法移动到Firebase pacakge。 参考链接是:https://developers.google.com/android/guides/releases#october_2016_-_version_98 现在需要更改build.gradle文件中的一些项目链接。

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 26
        multiDexEnabled = true
    }

    def applicationVersion = '1.20170612'
dexOptions {
    preDexLibraries = false
    javaMaxHeapSize "2g"
}
enter code here
lintOptions {
    checkReleaseBuilds false
    // Or, if you prefer, you can continue to check for errors in release builds,
    // but continue the build even when errors are found:
    abortOnError false

}

buildTypes {
    release {
        minifyEnabled false
    }
    debug {
        minifyEnabled false
    }
    }
}
dependencies {
compile project(':paymentGatewayCommons')
compile project(':paypal')
compile project(':paytm')
compile project(':payu')
compile 'com.fasterxml.jackson.core:jackson-core:2.9.0.pr1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.0.pr1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-base:11.0.1'
compile 'com.google.android.gms:play-services-cast-framework:11.0.1'
compile 'com.google.android.gms:play-services-places:11.0.1'
compile 'com.google.android.gms:play-services-nearby:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'
compile 'com.google.android.gms:play-services-analytics:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
compile 'com.google.zxing:core:3.2.0'
compile 'com.journeyapps:zxing-android-embedded:3.3.0@aar'
compile 'com.google.firebase:firebase-appindexing:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-analytics:11.0.1'
compile 'com.flurry.android:analytics:6.4.2'
compile 'com.android.support.constraint:constraint-layout:+'


  testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

还在Main项目build.gradle文件中更改

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }