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

May*_*sal 9 android gradle firebase 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'
Run Code Online (Sandbox Code Playgroud)

Kuv*_*lya 7

Firebase doc说:

收到"找不到"错误?确保您在Android SDK管理器中拥有最新的Google Repository

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

在此输入图像描述


May*_*sal 1

抛出此错误是因为 GooglePlayService 包中发生了一些更改。他们将一些类文件和方法移至 Firebase 包。参考链接是: 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'
Run Code Online (Sandbox Code Playgroud)

还要更改主项目 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
    }
Run Code Online (Sandbox Code Playgroud)