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.
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')
Thank you in advance for your help. This library with iOS is working great.
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.
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 updatedGoogle Repository
from 44 to 57 and that did the trick.Thank you again!