After upgrading RN to 0.60 from 0.59.9, I'm getting on Android on app launch, redbox: The [[DEFAULT]] firebase app has not been initialized!
I've tried all logical permutations of android configs I can think of, pasted below.
iOS works fine, issue is only on Android.
Click To Expand
#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [x] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
// https://github.com/oblador/react-native-keychain/issues/68#issuecomment-304803594
// gradle:2.3.3 since RN 0.56, but that causes ...Minimum required is 25.0.0 on modules (below). Also bunch of 'NDK is missing a "platforms" directory.' warnings
classpath("com.android.tools.build:gradle:3.4.1")
classpath 'com.google.gms:google-services:4.1.0' // was 3.0.0. 3.1.2 since RNFirebase 3.3.x. 3.3.0 latest. 4.2.0 since RNFirebase 5.x
classpath 'com.google.firebase:perf-plugin:1.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
// from what package?
maven { url "https://jitpack.io" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
}
#### `android/app/build.gradle`:
apply plugin: "com.android.application"
apply plugin: "com.google.firebase.firebase-perf"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
// project.ext.sentryCli = [
// logLevel: "debug"
// ]
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
// project.ext.vectoricons = [
// iconFontNames: [ 'FontAwesome.ttf', 'Entypo.ttf', 'MaterialIcons.ttf', 'MaterialCommunityIcons.ttf', 'SimpleLineIcons.ttf' ] // Name of the font files you want to copy
// ]
// apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = true
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.zeta.networks.wonderswipe"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled true // https://developer.android.com/studio/build/multidex
versionCode 1
versionName "1.4.1"
// ndk {
// abiFilters "armeabi-v7a", "x86"
// }
// renderscriptTargetApi 23 // https://github.com/react-native-community/react-native-blur#installation
// renderscriptSupportModeEnabled true
}
signingConfigs { // https://facebook.github.io/react-native/docs/signed-apk-android
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
// signingConfig signingConfigs.release
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
// HACKFIX: https://github.com/VeeShostak/react-native-ai-chat-hybrid/issues/13#issuecomment-346915333 for https://github.com/invertase/react-native-firebase/issues/17#issuecomment-386009595
packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
// after adding react-native-custom-tabs - * What went wrong:
// Execution failed for task ':app:transformClassesWithDexForDebug'.
// > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: Cannot merge new index 65629 into a non-jumbo instruction!
// https://stackoverflow.com/a/26248495/2322084
dexOptions {
jumboMode true
}
}
dependencies {
implementation project(':@react-native-community_netinfo')
implementation project(':rn-fetch-blob')
// implementation project(':@react-native-community_async-storage')
// implementation project(':@react-native-community_viewpager')
// implementation project(':react-native-webview')
// implementation project(':react-native-keep-awake')
// implementation project(':@sentry_react-native')
// implementation project(':react-native-code-push')
// implementation project(':react-native-custom-tabs')
// implementation project(':react-native-vector-icons')
// implementation project(':react-native-orientation')
// implementation project(':react-native-sha256')
// implementation project(':react-native-tts')
// implementation project(':@react-native-community_blur')
// implementation project(':react-native-linear-gradient')
// implementation(project(':react-native-firebase')) {
// transitive = false
// }
// implementation "com.google.android.gms:play-services-base:11.8.0" // Firebase dependencies
// implementation "com.google.firebase:firebase-core:11.8.0"
// implementation "com.google.firebase:firebase-analytics:11.8.0"
// implementation "com.google.firebase:firebase-auth:11.8.0"
// implementation "com.google.firebase:firebase-config:11.8.0"
// implementation "com.google.firebase:firebase-database:11.8.0"
// implementation "com.google.firebase:firebase-firestore:11.8.0"
// implementation "com.google.firebase:firebase-storage:11.8.0"
// implementation "com.google.firebase:firebase-messaging:11.8.0"
// implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // <-- Add this line if you wish to use badge on Android
// implementation "com.google.firebase:firebase-perf:11.8.0"
// https://rnfirebase.io/docs/v5.x.x/releases/v5.3.x#Android---Update-Dependencies - doesn't work, can get app to build but crash out to Android home screen on start, with no logs at all on Metro console - latest dependencies for 5.5.x: https://rnfirebase.io/docs/v5.x.x/releases/v5.5.x#Android---Update-Dependencies
implementation "com.google.android.gms:play-services-base:16.1.0" // Firebase dependencies
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.google.firebase:firebase-auth:17.0.0"
implementation "com.google.firebase:firebase-config:17.0.0"
implementation "com.google.firebase:firebase-database:17.0.0"
implementation "com.google.firebase:firebase-firestore:19.0.0"
implementation "com.google.firebase:firebase-storage:17.0.0"
implementation "com.google.firebase:firebase-messaging:18.0.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // <-- Add this line if you wish to use badge on Android
implementation "com.google.firebase:firebase-perf:17.0.2"
// implementation "com.google.firebase:firebase-storage:16.1.0"
// implementation "com.crashlytics.sdk.android:crashlytics:2.9.5"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
#### `android/settings.gradle`:
rootProject.name = 'wonderswipe'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':@react-native-community_netinfo'
project(':@react-native-community_netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android')
include ':rn-fetch-blob'
project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
// include ':@react-native-community_async-storage'
// project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
// include ':@react-native-community_viewpager'
// project(':@react-native-community_viewpager').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/viewpager/android')
// include ':react-native-webview'
// project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
// include ':react-native-keep-awake'
// project(':react-native-keep-awake').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keep-awake/android')
// include ':@sentry_react-native'
// project(':@sentry_react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@sentry/react-native/android')
// include ':react-native-code-push'
// project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
// include ':react-native-custom-tabs'
// project(':react-native-custom-tabs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-custom-tabs/android')
// include ':react-native-vector-icons'
// project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
// include ':react-native-orientation'
// project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
// include ':react-native-firebase'
// project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
// include ':react-native-sha256'
// project(':react-native-sha256').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sha256/android')
// include ':react-native-tts'
// project(':react-native-tts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-tts/android')
// include ':@react-native-community_blur'
// project(':@react-native-community_blur').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/blur/android')
// include ':react-native-linear-gradient'
// project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':app'
#### `MainApplication.java`:
package com.zeta.networks.wonderswipe;
import android.app.Application;
import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.reactnativecommunity.netinfo.NetInfoPackage;
import com.RNFetchBlob.RNFetchBlobPackage;
// import com.microsoft.codepush.react.CodePush;
// import io.sentry.RNSentryPackage;
// import com.github.droibit.android.reactnative.customtabs.CustomTabsPackage;
// import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
// import com.reactnativecommunity.viewpager.RNCViewPagerPackage;
// import com.reactnativecommunity.webview.RNCWebViewPackage;
// import com.corbt.keepawake.KCKeepAwakePackage;
// import com.oblador.vectoricons.VectorIconsPackage;
// import com.github.yamill.orientation.OrientationPackage;
// import com.sha256lib.Sha256Package;
// import net.no_mad.tts.TextToSpeechPackage;
// import com.cmcewen.blurview.BlurViewPackage;
// import com.BV.LinearGradient.LinearGradientPackage;
// import io.invertase.firebase.RNFirebasePackage;
// Optional packages for Firebase
// import io.invertase.firebase.admob.RNFirebaseAdMobPackage; //Firebase AdMob
// import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; // Firebase Analytics
// import io.invertase.firebase.auth.RNFirebaseAuthPackage; // Firebase Auth
// import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage; // Firebase Remote Config
// // import io.invertase.firebase.crash.RNFirebaseCrashPackage; // Firebase Crash Reporting
// import io.invertase.firebase.database.RNFirebaseDatabasePackage; // Firebase Realtime Database
// import io.invertase.firebase.firestore.RNFirebaseFirestorePackage; // Firebase Firestore
// import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; // Firebase Cloud Messaging
// import io.invertase.firebase.perf.RNFirebasePerformancePackage; // Firebase Performance
// import io.invertase.firebase.storage.RNFirebaseStoragePackage; // Firebase Storage
// import com.google.firebase.database.FirebaseDatabase; // for setPersistenceEnabled() below
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
// @Override
// protected String getJSBundleFile() {
// return CodePush.getJSBundleFile();
// }
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new NetInfoPackage());
packages.add(new RNFetchBlobPackage());
// packages.add(new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG));
// packages.add(new RNSentryPackage());
// packages.add(new CustomTabsPackage());
// packages.add(new AsyncStoragePackage());
// packages.add(new RNCViewPagerPackage());
// packages.add(new RNCWebViewPackage());
// packages.add(new KCKeepAwakePackage());
// packages.add(new VectorIconsPackage());
// packages.add(new OrientationPackage());
// packages.add(new Sha256Package());
// packages.add(new TextToSpeechPackage());
// packages.add(new BlurViewPackage());
// packages.add(new LinearGradientPackage());
// packages.add(new RNFirebasePackage());
// packages.add(new RNFirebaseAnalyticsPackage());
// packages.add(new RNFirebaseAuthPackage());
// packages.add(new RNFirebaseRemoteConfigPackage());
// packages.add(new RNFirebaseDatabasePackage());
// packages.add(new RNFirebaseFirestorePackage());
// packages.add(new RNFirebaseMessagingPackage());
// packages.add(new RNFirebasePerformancePackage());
// packages.add(new RNFirebaseStoragePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
// FirebaseDatabase.getInstance().setPersistenceEnabled(true);
}
}
#### `AndroidManifest.xml`:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zeta.networks.wonderswipe">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service
android:name="io.invertase.firebase.messaging.MessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.InstanceIdService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<receiver android:name="io.invertase.firebase.messaging.RNFirebaseLocalMessagingPublisher"/>
<receiver android:enabled="true" android:exported="true" android:name="io.invertase.firebase.messaging.RNFirebaseSystemBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
Click To Expand
**`react-native info` output:**
System:
OS: macOS 10.14.6
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 1.88 GB / 40.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.6.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.2 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
- **Platform that you're experiencing the issue on**:
- [ ] iOS
- [x] Android
- [ ] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`react-native-firebase` version you're using that has this issue:**
- `5.5.5`
- **`Firebase` module(s) you're using that has the issue:**
- N/A, can't get past the core module failing
- **Are you using `TypeScript`?**
- `N`
Think react-native-firebase
is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]
React Native Firebase
and Invertase
on Twitter for updates on the library.Can you see anything in the logs? The com.google.gms.google-services plugin does spit out errors if it can't find the JSON file, or can't read it.
Where would that log be? apply plugin: 'com.google.gms.google-services'
has been in my app's build.gradle before RN 0.60 upgrade for a long while, that line and firebase config hasn't changed.
If you mean adb logcat "*:E"
, I can look again but I did use that to fix crash on app launch issues before getting to the red screen in app I'm getting now.
Also note that I've tried rm -rf node_modules ; yarn
already, no difference when it comes to redbox.
I have exactly the same issue on iOS.
info Fetching system and libraries information...
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 3.96 GB / 32.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 26, 27, 28
Build Tools: 23.0.1, 25.0.0, 26.0.3, 27.0.3, 28.0.1, 28.0.2, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: ^16.8.6 => 16.8.6
react-native: ^0.60.4 => 0.60.4
npmGlobalPackages:
eslint-plugin-react-native: 3.5.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Same issue
but I my version is react-native-firebase": "^5.5.4" and "react-native": "0.59.9",
Ok, I found the fix.
In android/build.gradle:
classpath 'com.google.gms:google-services:4.2.0'
// 4.1.0 does not work!
android/app/build.gradle:
// WORKAROUND for com.google.gms:google-services:4.2.0: https://github.com/invertase/react-native-firebase/issues/1676#issuecomment-441243419
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
and in MainApplication.java, appropriate packages added. All except main RNFirebasePackage
as that's done by RN 0.60's autolink:
packages.add(new RNFirebaseAnalyticsPackage());
packages.add(new RNFirebaseAuthPackage());
packages.add(new RNFirebaseRemoteConfigPackage());
packages.add(new RNFirebaseDatabasePackage());
packages.add(new RNFirebaseFirestorePackage());
packages.add(new RNFirebaseMessagingPackage());
packages.add(new RNFirebasePerformancePackage());
packages.add(new RNFirebaseStoragePackage());
I haven't been able to reproduce this in my demo, perhaps I am doing something different from others, or I am doing exactly what @fungilation does, but if anyone wants to see the end result of a react-native-firebase install is (that appears to work) clone this repo and run this script - you can inspect the install steps and see the final product to see if doing the same works for you https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh
One more thing to say about @fungilation s answer which fixed my issue (thanks a lot!) is, place the com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
underneath
// For react-native-firebase
// https://rnfirebase.io/docs/v5.x.x/installation/android#2.-Setup-google-services.json
apply plugin: 'com.google.gms.google-services'
Where to put it in android/app/build.gradle? sir
Like this - the dependency is added in the dependencies block, apply is at the very tail of the file https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh#L35
thank you sir
//Put this on bottom of file android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
Most helpful comment
Ok, I found the fix.
In android/build.gradle:
classpath 'com.google.gms:google-services:4.2.0'
// 4.1.0 does not work!android/app/build.gradle:
and in MainApplication.java, appropriate packages added. All except main
RNFirebasePackage
as that's done by RN 0.60's autolink: