React-native-firebase: Struggling with Android Install - Failed to resolve: com.google.firebase:firebase-core:11.0.0

Created on 2 Aug 2017  路  3Comments  路  Source: invertase/react-native-firebase

I followed the Android installation instructions as best as possible but I'm still running into issues just getting things to build. I had been using the firebase web SDK just fine on Android.

screen shot 2017-08-02 at 12 55 20 pm

android/build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
        classpath 'com.google.gms:google-services:3.1.0'  // some parts of the docs say 3.0.0, others say 3.1.0
    }
}

from android/app/build.gradle:

dependencies {
    compile project(':react-native-permissions')
    compile project(':react-native-onesignal')
    compile project(':bugsnag-react-native')
    compile project(':react-native-blur')
    compile project(':react-native-image-picker')
    compile project(':react-native-view-shot')
    compile project(':react-native-spinkit')
    compile project(':react-native-svg')
    compile project(':react-native-vector-icons')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-camera')
    compile project(':react-native-code-push')
    compile project(':react-native-device-info')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':libs:SalesforceReact')     // From node_modules

    // RNFirebase required dependencies
    compile(project(':react-native-firebase')) {
      transitive = false
    }
    compile "com.google.firebase:firebase-core:11.0.0"

    // RNFirebase optional dependencies
    compile "com.google.firebase:firebase-auth:11.0.0"
    compile "com.google.firebase:firebase-database:11.0.0"
}
// ...
// last line of file is below
apply plugin: 'com.google.gms.google-services'

from android/settings.gradle:

include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')

Environment

  1. Target Platform (e.g. iOS, Android): Android
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
  4. React Native version (e.g. 0.45.1): 0.43.4
  5. RNFirebase Version (e.g. 2.0.2): 2.0.4

Thank you in advance for your help. This library with iOS is working great.

Most helpful comment

@Ehesp -- Thank you! Super helpful.

I first tried to added Google Play Services in the SDK manager but that alone didn't resolve the issue. I then updated Google Repository from 44 to 57 and that did the trick.

Thank you again!

All 3 comments

In Android Studio, open the SDK manager and make sure you've updated all of the Google Service type packages. You'll need the 11.* one(s), otherwise you'll get this error.

@Ehesp -- Thank you! Super helpful.

I first tried to added Google Play Services in the SDK manager but that alone didn't resolve the issue. I then updated Google Repository from 44 to 57 and that did the trick.

Thank you again!

If anyone else finds this after realising they know nothing about native Android dev, desperately Googling the error message, then still not having any luck with the above (100% definitely not me lol) .....after adding / updating the above SDK things, you also need to Build > Clean then Build > Rebuild for it to work. The Gradle sync thing will still initially complain without that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Draccan picture Draccan  路  3Comments

jonaseck2 picture jonaseck2  路  3Comments

csumrell picture csumrell  路  3Comments

callmejm picture callmejm  路  3Comments

n-scope picture n-scope  路  3Comments