React-native-firebase: [馃悰] Unable to resume activity {com.XXXXXXX/com.google.firebase.auth.internal.RecaptchaActivity}

Created on 25 Jan 2021  路  10Comments  路  Source: invertase/react-native-firebase


Issue



When entering phone and proceed for OTP request, it throws this error on logcat: (real device, Xiaomi Note 8, Android 10)

2021-01-25 14:49:04.419 19986-19986/com.XXXXXXX E/zzbf: SafetyNet Attestation has advice: 
    LOCK_BOOTLOADER
2021-01-25 14:49:04.761 19986-19986/com.XXXXXXX E/FirebearCryptoHelper: Exception encountered during crypto setup:
    Protocol message contained an invalid tag (zero).
2021-01-25 14:49:04.763 19986-19986/com.XXXXXXX E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.XXXXX, PID: 19986
    java.lang.RuntimeException: Unable to resume activity {com.XXXXXX/com.google.firebase.auth.internal.RecaptchaActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.internal.firebase-auth-api.zzau com.google.android.gms.internal.firebase-auth-api.zzds.zza()' on a null object reference
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4272)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4304)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2046)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:225)
        at android.app.ActivityThread.main(ActivityThread.java:7564)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.internal.firebase-auth-api.zzau com.google.android.gms.internal.firebase-auth-api.zzds.zza()' on a null object reference
        at com.google.firebase.auth.internal.zzk.zzb(com.google.firebase:firebase-auth@@20.0.2:2)
        at com.google.firebase.auth.internal.RecaptchaActivity.zzd(com.google.firebase:firebase-auth@@20.0.2:10)
        at com.google.android.gms.internal.firebase-auth-api.zztw.<init>(com.google.firebase:firebase-auth@@20.0.2:13)
        at com.google.firebase.auth.internal.RecaptchaActivity.onResume(com.google.firebase:firebase-auth@@20.0.2:43)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)
        at android.app.Activity.performResume(Activity.java:8073)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4262)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4304)聽
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)聽
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)聽
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)聽
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2046)聽
        at android.os.Handler.dispatchMessage(Handler.java:107)聽
        at android.os.Looper.loop(Looper.java:225)聽
        at android.app.ActivityThread.main(ActivityThread.java:7564)聽
        at java.lang.reflect.Method.invoke(Native Method)聽
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)聽
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)聽

Both SHA-1 & SHA256 on firebase project settings, re-downloaded google services json. This came out of the sudden, can't figure out where the issue is coming from. Everything was working just fine, i've just updated to 10.5.1.

Project Files






Javascript

Click To Expand

#### `package.json`:

{
  "name": "XXXXXXXX",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "postversion": "bundle exec fastlane sync_package_version",
    "start": "node node_modules/react-native/local-cli/cli.js start --reset-cache",
    "build": "tsc",
    "lint": "eslint '**/*.{tsx,ts}'",
    "studio": "open -a /Applications/Android\\ Studio.app ./android/",
    "ci": "yarn prettier && yarn lint && yarn build",
    "postinstall": "patch-package && jetify",
    "prettier": "prettier \"**/*.{ts,tsx}\" --write",
    "debugger": "open \"rndebugger://set-debugger-loc?host=localhost&port=8081\""
  },
  "workspaces": {
    "nohoist": [
      "**"
    ]
  },
  "resolutions": {
    "styled-components": "5.2.1"
  },
  "dependencies": {
    "@freakycoder/react-native-progressive-fast-image": "^0.2.2",
    "@gorhom/bottom-sheet": "2.0.5",
    "@invertase/react-native-apple-authentication": "^2.1.0",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "^1.13.3",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/cameraroll": "^4.0.1",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/eslint-config": "^2.0.0",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.10",
    "@react-native-community/push-notification-ios": "^1.8.0",
    "@react-native-community/toolbar-android": "^0.1.0-rc.2",
    "@react-native-firebase/analytics": "^10.5.1",
    "@react-native-firebase/app": "^10.5.0",
    "@react-native-firebase/auth": "^10.5.1",
    "@react-native-firebase/crashlytics": "^10.5.1",
    "@react-native-firebase/database": "^10.5.1",
    "@react-native-firebase/dynamic-links": "^10.5.1",
    "@react-native-firebase/firestore": "^10.5.1",
    "@react-native-firebase/functions": "^10.5.1",
    "@react-native-firebase/messaging": "^10.5.1",
    "@react-native-firebase/storage": "^10.5.1",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.1",
    "@rnhooks/keyboard": "^0.0.3",
    "@segment/analytics-react-native": "^1.3.2",
    "@types/qs": "^6.9.5",
    "@types/react": "^17.0.0",
    "@types/react-native": "^0.63.46",
    "@types/react-native-fbsdk": "^3.0.0",
    "@types/react-native-vector-icons": "^6.4.6",
    "@types/styled-components": "^5.1.7",
    "@types/uuid": "^8.3.0",
    "buffer": "^5.6.0",
    "color-alpha": "^1.1.2",
    "contains-emoji": "^1.0.5",
    "date-fns": "^2.16.1",
    "dcd-fast-list": "^1.0.7",
    "file-type": "^14.2.0",
    "hermes-engine": "0.5.2-rc1",
    "is-string-and-not-blank": "^0.0.2",
    "js-base64": "^2.5.2",
    "lodash": "^4.17.20",
    "mention-hashtag": "^1.1.1",
    "qs": "^6.9.6",
    "react": "16.13.1",
    "react-native": "^0.63.4",
    "react-native-actions-sheet": "^0.4.2",
    "react-native-appearance": "^0.3.4",
    "react-native-bootsplash": "^3.1.2",
    "react-native-camera": "^3.42.0",
    "react-native-code-push": "^7.0.0",
    "react-native-confirmation-code-field": "^6.5.1",
    "react-native-console-time-polyfill": "^1.2.1",
    "react-native-device-info": "^8.0.1",
    "react-native-draggable-grid": "2.1.2",
    "react-native-email": "^1.1.0",
    "react-native-fast-image": "^8.3.4",
    "react-native-fbsdk": "^3.0.0",
    "react-native-file-access": "^1.0.2",
    "react-native-flash-message": "^0.1.21",
    "react-native-geolocation-service": "^4.0.2",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-get-random-values": "^1.5.1",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-global-props": "^1.1.5",
    "react-native-idle-timer": "^2.1.6",
    "react-native-image-crop-tools": "^1.3.6",
    "react-native-image-picker": "^3.1.4",
    "react-native-image-progress": "^1.1.1",
    "react-native-image-resizer": "^1.4.2",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-inappbrowser-reborn": "^3.5.1",
    "react-native-indicators": "^0.17.0",
    "react-native-iphone-x-helper": "^1.3.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-keyboard-height": "^1.1.2",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.6.1",
    "react-native-modalize": "^2.0.8",
    "react-native-navigation-bar-color": "^2.0.1",
    "react-native-notifier": "^1.3.2",
    "react-native-pages": "^0.9.0",
    "react-native-parsed-text": "^0.0.22",
    "react-native-permissions": "^3.0.0",
    "react-native-portal": "https://github.com/bailycase99/react-native-portal",
    "react-native-portalize": "^1.0.7",
    "react-native-progress": "^4.1.2",
    "react-native-reanimated": "^1.13.2",
    "react-native-redash": "^16.0.8",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-root-view-background": "https://github.com/rafcontreras/react-native-root-view-background",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.16.1",
    "react-native-share": "^5.1.0",
    "react-native-size-matters": "^0.3.1",
    "react-native-smart-tip": "^2.2.1",
    "react-native-sound": "^0.11.0",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-svg": "^12.1.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-tab-view": "^2.15.2",
    "react-native-text-input-reset": "^1.0.4",
    "react-native-vector-icons": "^8.0.0",
    "react-native-walkthrough-tooltip": "^1.1.11",
    "styled-components": "^5.2.1",
    "timeago.js": "^4.0.2",
    "typescript": "4.0.5",
    "use-state-with-callback": "^2.0.3",
    "uuid": "^8.3.2",
    "with-query": "^1.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^2.0.0",
    "@types/react-native-share": "^3.3.1",
    "babel-jest": "^25.1.0",
    "babel-plugin-styled-components": "1.12.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "^6.5.1",
    "eslint-config-prettier": "^7.1.0",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-react-native-a11y": "^2.0.4",
    "jest": "^25.1.0",
    "jetifier": "^1.6.4",
    "lint-staged": "^10.5.3",
    "metro-react-native-babel-preset": "^0.59.0",
    "patch-package": "^6.2.2",
    "postinstall-postinstall": "^2.0.0",
    "prettier": "^2.2.1",
    "react-native-ruler": "^0.1.0",
    "react-test-renderer": "16.13.1",
    "tslint": "^6.1.1",
    "tslint-config-prettier": "^1.18.0",
    "tslint-react": "^5.0.0"
  }
}

#### `firebase.json` for react-native-firebase v6:
# N/A
### iOS
Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

# N/A
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] 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`:

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        supportLibVersion = "29.0.0"
        googlePlayServicesVisionVersion = "19.0.0"
        //googlePlayServicesAuthVersion = "15.0.1"
        // googlePlayServicesVersion = "16.1.0" // Used by react-native-device-info with this, it will download AndroidX with 17.0.0
    }
    repositories {
       mavenLocal()
              google()
              jcenter()
              maven {
                  url 'https://maven.fabric.io/public'
              }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.0'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        classpath 'io.fabric.tools:gradle:1.28.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        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")
        }

    }
}

#### `android/app/build.gradle`:
apply plugin: "com.android.application"

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",
 *
 *   // 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 = [
    enableHermes: false,
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

/**
 * Set this to drawtrue 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 = false

/**
 * 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 {
    signingConfigs {
        signing {
            keyAlias 'xxxxxxx'
            keyPassword 'xxxxxxxx'
            storeFile file('../keystores/release.keystore')
            storePassword 'xxxxxxxx'
        }
    }
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.xxxxxxx"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1783
        versionName "1.4.117"
        multiDexEnabled true
        ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        missingDimensionStrategy 'react-native-camera', 'general'

    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.signing
        }
        debug {
            signingConfig signingConfigs.signing
        }
    }
    configurations.all {
            resolutionStrategy {
                force "com.facebook.soloader:soloader:0.9.0+"
            }
        }
    // 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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            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
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])

    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    implementation project(':react-native-safe-area-context')
    implementation 'androidx.appcompat:appcompat:1.2.0'

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
          exclude group:'com.facebook.fbjni'
        }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
            exclude group:'com.facebook.flipper'
            exclude group:'com.squareup.okhttp3', module:'okhttp'
        }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
            exclude group:'com.facebook.flipper'
        }

    if (enableHermes) {
      def hermesPath = "../../node_modules/hermes-engine/android/"
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }

    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

    implementation 'com.facebook.android:facebook-android-sdk:7.1.0'
    implementation 'com.facebook.android:facebook-login:[8.1)'
    implementation 'com.facebook.fresco:animated-gif:2.0.0'
    implementation "androidx.browser:browser:1.3.0"
//     implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
//         transitive = true
//     }

    implementation 'androidx.multidex:multidex:2.0.1'
}

// 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'
apply plugin: 'com.google.firebase.crashlytics'
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

#### `android/settings.gradle`:
rootProject.name = 'XXXXX'
include ':react-native-safe-area-context'
project(':react-native-safe-area-context').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-safe-area-context/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':hermes-engine'
project(':hermes-engine').projectDir = new File(rootProject.projectDir, '../node_modules/hermes-engine/android/')

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


#### `MainApplication.java`:
package com.XXXXXX;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import androidx.multidex.MultiDex;
import com.facebook.CallbackManager;
import com.facebook.appevents.AppEventsLogger;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactApplication;
import com.th3rdwave.safeareacontext.SafeAreaContextPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.microsoft.codepush.react.CodePush;
import java.util.Arrays;
import java.util.List;
import java.lang.reflect.InvocationTargetException;

public class MainApplication extends Application implements ReactApplication {

  private static CallbackManager mCallbackManager = CallbackManager.Factory.create();

  protected static CallbackManager getCallbackManager() {
    return mCallbackManager;
  }

  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.addAll(Arrays.<ReactPackage>asList(
        new SafeAreaContextPackage()
      ));

      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);
    AppEventsLogger.activateApp(this);
    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
  }

  /**
   * Loads Flipper in React Native templates.
   *
   * @param context
   */
  private static void initializeFlipper(
        Context context, ReactInstanceManager reactInstanceManager) {
      if (BuildConfig.DEBUG) {
        try {
          /*
           We use reflection here to pick up the class that initializes Flipper,
          since Flipper library is not available in release mode
          */
          Class<?> aClass = Class.forName("com.XXXXXX.ReactNativeFlipper");
          aClass
              .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
              .invoke(null, context, reactInstanceManager);
        } catch (ClassNotFoundException e) {
          e.printStackTrace();
        } catch (NoSuchMethodException e) {
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        } catch (InvocationTargetException e) {
          e.printStackTrace();
        }
      }
    }

  @Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }
}

#### `AndroidManifest.xml`:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.XXXXXX">

    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />
            <data android:mimeType="image/*" />
        </intent>
        <intent>
            <action android:name="android.intent.action.PICK" />
            <data android:mimeType="image/*" />
        </intent>
        <intent>
            <action android:name="android.intent.action.CHOOSER" />
        </intent>
    </queries>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <application
        android:name=".MainApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:theme="@style/AppTheme"
        android:requestLegacyExternalStorage="true"
        tools:ignore="GoogleAppIndexingWarning">
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
            android:launchMode="singleTask"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:exported="true"
            android:windowSoftInputMode="adjustResize"/>
        <activity
            android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
            android:theme="@style/BootTheme"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:host="xxxxxx.page.link" android:scheme="https"/>
                <data android:host="xxxxxx.page.link" android:scheme="https"/>
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
    </application>

</manifest>


Environment

Click To Expand

**`react-native info` output:**

System:
    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Memory: 48.79 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v12.18.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /Users/stathis/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 26, 28, 29
      Build Tools: 28.0.3, 29.0.2, 29.0.3
      System Images: android-27 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.3/12C33 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_275 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: ^0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

- **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:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`




Needs Triage Bug

All 10 comments

I'm not sure where FirebearCryptoHelper is coming from, but my guess is it is some 3rd party dependency that is unrelated to Firebase, but does not correctly implement cryptographic protocols that are needed by firebase. I can't find any information online or via a search through multiple firebase-using projects that use firebase auth, so this will be project specific.

I will note that there should be no references to "fabric" in your project at all, but you still have them in your build.grade. You should not have any @types in your dependencies, those are devDependencies, etc.

I see nothing with react-native-firebase in your crash trace so I'm going to close this unless you can reproduce the crash in a clean project with a self-contained App.js we can drop in to e.g. https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

Thanks for looking into it Mike, I'll try to figure out where this Firebear is coming from, I was also curious what is this. If problem persists I'll create a clean app and let you know the results. Yes I'll remove Fabric asap, it's on my to do list.

@mikehardy it seems Firebear is related to Identity Toolkit, I've found some traces of it in googleapis npm package that i'm using on my cloud functions folder (it's a monorepo project)

Interesting, I'm not using Identity Toolkit though I do have a monorepo with cloud functions in a separate area. I didn't think to look outside my react-native package as nothing outside of it will have bearing as it won't get packaged into the app. Very strange. One further note is specifically if the stack does not contain any react-native-firebase code, it will be an upstream issue (assuming you can reproduce it) so it may be best to pattern your clean reproduction off of their quickstart https://github.com/firebase/quickstart-android/tree/master/auth

I have a feeling that this has to do with Android Backup, will test with android:allowBackup="false" & android:fullBackupContent="false" on AndroidManifest and see the outcome

@mikehardy can confirm, backup is causing this issue to rise.

according to this comment on so, disabling backup fixes it.

Fascinating, that's unexpected. I assume you are using encrypted shared preferences, so that SO post is on target? Or is it sort-of unrelated but inspired the fix?

It inspired the fix, i鈥檝e already had backup enabled so i gave it a go

@mikehardy do you think I should create an issue on upstream?

I believe the issue was raised because I鈥檓 constantly installing and uninstalling different versions of the app (dev/prod) on the device either via Android Studio or download & install from appcenter. Maybe at some point It might got screwed up with the backups.

Another red flag that pointed me to the reason that backup is the cause was the fact that when installing the app via Studio (by first uninstalling it from device) it loaded the bundle from metro without issues while in the past I鈥檝e always had to enter the metro server url in dev settings of the app. So, it was not an 100% clean install, somehow.

ps. I ve recently upgraded from Android 9 to 10 and I鈥檝e might had enabled backup on my google account on the phone, I believe while I was on 9 I had backups off, that鈥檚 why it kicked in now, I suppose.

Maybe? Sorry to be vague, but I'm not sure who would own a prefs backup issue. It may be that no one does... I can say from my perspective at least I use android build flavors to maintain fully separate apps for my different environments. Perhaps that's one reason I've never seen this personally, prod is prod is prod, no real switching

Was this page helpful?
0 / 5 - 0 ratings