Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve: com.google.firebase:firebase-storage-common:11.0.1

I am upgrading my Android Studio, Gradle version 2.3 to 2.3.3, also have updated my sdk - API level 26, SDK build tool 26, Google Play Service 41, Google Repository 54.

When I clean my project, I get this error: 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'
like image 520
Mayur Misal Avatar asked Jun 23 '17 13:06

Mayur Misal


2 Answers

Make sure from group com.google.android.gms and from group com.google.firebase have same version.

For example, current latest version is 11.0.1, therefore all dependencies from com.google.android.gms and com.google.firebase should have version 11.0.1. In your dependencies list following two have a different version. Make sure they too have version 11.0.1.

For achieving that

You will need to migrate Play Services App indexing to Firebase App indexing. The guide is here.

According to Google Awareness API v9.6 is missing contextmanager api was changed to Awareness API. So you'll also need to update your code accordingly.

like image 81
BhalchandraSW Avatar answered Oct 13 '22 02:10

BhalchandraSW


The best Method to fix this problem is not using the manual method of linking firebase to your app.

I have tried adding latest firebase repo by referring to this Link .

It showed error " failed to resolve the dependencies"

FireBase recommends adding firebase to your app with the help of FireBase Assistant for Android Studio Version 2.2 and Higher. Manually adding the latest library to build-gradle(module) result in an error as above.

Using Firebase assistant is so easy and 2 step process. For reference, You can use the "Use the Firebase Assistant" section on the same link mentioned above.

It Really worked Out with my Android Studio 2.3.3

like image 34
Shreevara K Avatar answered Oct 13 '22 03:10

Shreevara K