16

I am trying to upgrade my Firebase libraries to the new 9.4.0 version; however, I get the "can't resolve" error in Gradle upon syncing. Here's the error:

Error:(38, 13) Failed to resolve: com.google.firebase:firebase-core:9.4.0
Error:(40, 13) Failed to resolve: com.google.firebase:firebase-auth:9.4.0
Error:(40, 13) Failed to resolve: com.google.firebase:firebase-storage:9.4.0

Tried with and without firebase-core, no difference.

Here's my Gradle for both app and project level: project level:

  buildscript {
repositories {
    jcenter()
    mavenLocal()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.google.gms:google-services:3.0.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
 }

 allprojects {
repositories {
    jcenter()
    mavenLocal()
}
}

 task clean(type: Delete) {
delete rootProject.buildDir
}

and for the module:app level: apply plugin: 'com.android.application'

    android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
    applicationId "com.example.main.projectone"
    minSdkVersion 18
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
    }
}
 }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

//  compile 'com.google.android.gms:play-services-gcm:9.2.0'
//  compile 'com.google.android.gms:play-services:9.2.1'

compile('com.facebook.android:facebook-android-sdk:4.7.0') {
    exclude module: 'bolts-android'
}

//  compile 'com.fasterxml.jackson.core:jackson-core:2.8.1'
// compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1'


compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-storage:9.4.0'
compile 'com.android.support:design:24.0.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
}

 apply plugin: 'com.google.gms.google-services'

Any idea why Gradle cannot resolve the libraries? Here's Firebase website addressing them Firebase Newest Libs. Appreciate your help.

TheBen
  • 3,410
  • 3
  • 26
  • 51
  • 1
    Possible duplicate of [Failed to resolve: com.google.firebase:firebase-core:9.0.0](http://stackoverflow.com/questions/37310188/failed-to-resolve-com-google-firebasefirebase-core9-0-0) – Sam Stern Aug 09 '16 at 00:24
  • Can you help me with this [question](https://stackoverflow.com/questions/47438092/in-app-billing-connect-to-firebase-and-get-products) please? – StuartDTO Nov 27 '17 at 09:32
  • @Stuart2041 Sorry, it's been awhile I havn't been around Android but if the answer already posted to your question doesn't help let me know and I'd be happy to take another look. Cheers – TheBen Nov 27 '17 at 16:13
  • Feel free to take a look @TheeBen :D – StuartDTO Nov 28 '17 at 10:40

3 Answers3

15

Update the SDK Tools in Android Studio. After upgrading Google Play Services and Google Repository to the latest versions, I was able to resolve the same issue faced with latest version 9.4.0 of Firebase libraries Android Studio SDK Tools

tony m
  • 4,769
  • 1
  • 21
  • 28
3

I had exactly the same problem and don't understand it, but what fixed it for me:

I went to SDK Manager -> SDK Tools and updated "Google Repository" from rev 31 to rev 32. After that I tried to sync my project again and it magically worked.

Wolf
  • 892
  • 2
  • 8
  • 22
  • I think updating google repository was required but I didn't know I need to change something manually after downloading it in SDK. Thanks man. – TheBen Aug 27 '16 at 15:06
0

In your module:app, try adding compile 'com.google.android.gms:play-services:9.4.0' instead of compile 'com.google.android.gms:play-services:9.2.1' since, you are using all Firebase libraries of the new 9.4.0 version. Or you can just pick the required new libraries as suggested in Setting Up Google Play Services

niraj
  • 17,498
  • 4
  • 33
  • 48