Closed mcgomez closed 4 years ago
So I don't think this is related to react-native-firebase
. I found these events in another document that had a null documentId. So I believe it's related to mobx
or async-storage
(where we store the document Id).
Issue
I have a HeadlessJS task set up using react-native-background-geolocation, in this task I create a document periodically within a collection. After a certain period of time (this mostly happens overnight), documents continue to get created (I can see the document Id printed out in the logs), however they are not showing up in the console.
The headlessJS task runs fine, I can check the logs specific to
react-native-background-geolocation
, but I'm not seeing any errors related to firestore.The following log is during the headlessJS task. I can see that the document was created (I'm printing out the ID here), but it hasn't shown up in the console.
Note: test device - Pixel 3, Android 10 with the application removed from the Battery Optimization list Note: using anonymous authentication, and we sign the user in when the application is opened
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "v-check-24", "version": "0.0.1", "private": true, "repository": { "url": "https://github.com/cuttlesoft/vcheck24.mobile" }, "scripts": { "adb": "adb reverse tcp:9090 tcp:9090 && adb reverse tcp:3000 tcp:3000 && adb reverse tcp:9001 tcp:9001 && adb reverse tcp:8081 tcp:8081", "android:build": "cd android && ./gradlew assembleRelease", "android:devices": "$ANDROID_HOME/platform-tools/adb devices", "android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk", "android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease", "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V", "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82", "clean:android": "cd android/ && ./gradlew clean && cd ..", "clean:ios": "rm -rf ios/build", "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force", "format:test": "prettier \"{src, tests}/**/*.{js,jsx,json,md}\" --check", "format": "prettier \"{src, tests}/**/*.{js,jsx,json,md}\" --write", "lint:fix": "eslint --ext js --ext jsx --fix \"{src,test}/**/*.{js,jsx}\"", "lint": "eslint --ext js --ext jsx \"{src,test}/**/*.{js,jsx}\"", "patch": "patch-package", "postinstall": "npx jetify", "start": "react-native start", "test": "jest" }, "dependencies": { "@react-native-community/async-storage": "^1.7.1", "@react-native-community/cli-platform-android": "^3.0.3", "@react-native-community/masked-view": "^0.1.6", "@react-native-community/netinfo": "^4.6.1", "@react-native-community/push-notification-ios": "1.2.2", "@react-native-firebase/analytics": "6.3.4", "@react-native-firebase/app": "6.3.4", "@react-native-firebase/auth": "6.3.4", "@react-native-firebase/dynamic-links": "6.3.4", "@react-native-firebase/firestore": "6.3.4", "@react-native-firebase/storage": "6.3.4", "@react-navigation/native": "^5.0.1", "@react-navigation/stack": "^5.0.1", "@sentry/cli": "^1.54.0", "@sentry/react-native": "1.4.5", "@sentry/wizard": "^1.0.2", "@storybook/addon-storyshots": "^5.2.5", "@storybook/react-native": "^5.2.5", "add": "^2.0.6", "axios": "^0.19.0", "babel-eslint": "^10.0.3", "babel-preset-react-native": "^4.0.1", "buffer": "^5.4.3", "eslint-config-airbnb": "^18.0.1", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-prettier": "^3.1.1", "flag": "^4.4.0", "i18n-js": "^3.0.11", "libphonenumber-js": "^1.7.29", "lodash": "^4.17.15", "lodash.throttle": "4.1.1", "mobx": "^4.13.0", "mobx-react": "^6.1.1", "mobx-state-tree": "^3.14.1", "mobx-sync": "^3.0.0", "moment": "^2.24.0", "prop-types": "^15.7.2", "ramda": "0.26.1", "react": "16.9.0", "react-native": "0.61.5", "react-native-appstate-hook": "^1.0.3", "react-native-background-fetch": "3.0.6", "react-native-background-geolocation-android": "git+ssh://git@github.com/transistorsoft/react-native-background-geolocation-android.git", "react-native-camera": "^3.15.1", "react-native-countdown-component": "2.6.0", "react-native-device-info": "^4.0.1", "react-native-disable-battery-optimizations-android": "https://github.com/cuttlesoft/react-native-disable-battery-optimizations-android", "react-native-dotenv": "^0.2.0", "react-native-fs": "2.15.2", "react-native-gesture-handler": "^1.5.6", "react-native-localize": "^1.0.0", "react-native-onesignal": "^3.6.4", "react-native-permissions": "^2.0.9", "react-native-push-notification": "4.0.0", "react-native-queue": "https://github.com/cuttlesoft/react-native-queue-asyncstorage", "react-native-reanimated": "^1.7.0", "react-native-safe-area-context": "^0.7.2", "react-native-screens": "^2.0.0-beta.2", "react-native-splash-screen": "3.1.1", "react-powerplug": "1.0.0", "reactotron-mst": "^3.1.1", "reactotron-react-native": "^4.0.0-beta.1", "rrule": "^2.6.2", "validate.js": "0.13.1", "yarn": "^1.22.4" }, "devDependencies": { "@babel/core": "^7.5.5", "@babel/plugin-proposal-decorators": "^7.0.0", "@babel/plugin-proposal-optional-catch-binding": "^7.0.0", "@babel/runtime": "^7.5.5", "@emotion/core": "^10.0.15", "@storybook/addon-actions": "^5.2.5", "@storybook/addon-links": "^5.2.5", "@storybook/addons": "^5.2.5", "@testing-library/react-native": "^4.1.0", "babel-core": "7.0.0-bridge.0", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", "emotion-theming": "^10.0.14", "eslint": "^6.1.0", "eslint-config-prettier": "^6.0.0", "eslint-config-standard": "^13.0.1", "eslint-plugin-import": "^2.15.0", "eslint-plugin-jest": "^23.0.2", "eslint-plugin-node": "^9.1.0", "eslint-plugin-promise": "^4.0.1", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-native": "^3.6.0", "eslint-plugin-standard": "^4.0.0", "husky": "^3.0.9", "ignite-bowser": "^4.7.0", "jest": "^24.9.0", "jetifier": "^1.6.1", "metro-react-native-babel-preset": "^0.56.0", "npm-run-all": "4.1.5", "patch-package": "6.1.2", "postinstall-prepare": "1.0.1", "prettier": "1.18.2", "react-devtools-core": "3.6.3", "react-dom": "16.8.6", "react-test-renderer": "16.8.6", "rimraf": "2.6.3", "solidarity": "2.3.1" }, "jest": { "preset": "@testing-library/react-native", "moduleNameMapper": { "^React$": "/node_modules/react"
},
"setupFiles": [
"/node_modules/react-native/jest/setup.js",
"/test/setup.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/e2e"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-native|react-navigation|@react-navigation|@storybook|@react-native-community)"
]
},
"prettier": {
"printWidth": 100,
"semi": false,
"singleQuote": false,
"trailingComma": "all"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": [
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-native/all",
"standard"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"react",
"react-native"
],
"settings": {
"react": {
"pragma": "React",
"version": "detect"
}
},
"globals": {
"jasmine": false,
"beforeAll": false,
"afterAll": false,
"beforeEach": false,
"afterEach": false,
"test": false,
"expect": false,
"describe": false,
"jest": false,
"it": false
},
"rules": {
"comma-dangle": 0,
"no-unused-vars": 0,
"no-undef": 0,
"quotes": 0,
"react/no-unescaped-entities": 0,
"react/prop-types": "off",
"react-native/no-raw-text": 0,
"space-before-function-paren": 0,
"@typescript-eslint/indent": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/member-delimiter-style": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-object-literal-type-assertion": 0,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-var-requires": 0
}
},
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
}
}
```
#### `firebase.json` for react-native-firebase v6:
```json
// N/A
```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '9.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' def sharedPods # Pods for VCheck24 pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' # react-native-permissions permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec" pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec" pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec" pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec" pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec" pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec" pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec" pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec" pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec" pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec" pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec" pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec" pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec" pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec" # Firebase pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app' pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics' pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth' pod 'RNFBFirestore', :path => '../node_modules/@react-native-firebase/firestore' pod 'RNSentry', :path => '../node_modules/@sentry/react-native' pod 'Sentry' # Native module for crash reporting use_native_modules! end target 'VCheck24' do sharedPods end target 'VCheck24 Local' do sharedPods end target 'VCheck24 Dev' do sharedPods end target 'VCheck24 Staging' do sharedPods end target 'VCheck24 QA' do sharedPods end target 'VCheck24Tests' do inherit! :search_paths # Pods for testing end target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.9.3', '< 3.0' end target 'VCheck24-tvOS' do # Pods for VCheck24-tvOS target 'VCheck24-tvOSTests' do inherit! :search_paths # Pods for testing end end ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "AppDelegate.h" #import
#import
#import
#import
#import
@import Firebase;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Firebase
[FIRApp configure];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"VCheck24"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
// Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
}
// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// IOS 10+ Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
completionHandler();
}
// IOS 4-10 Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[RNCPushNotificationIOS didReceiveLocalNotification:notification];
}
@end
```
Android
Click To Expand
#### Have you converted to AndroidX? - [X] 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`: ```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { googlePlayServicesLocationVersion = "17.0.0" buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" appCompatVersion = "1.0.2" } repositories { google() jcenter() } dependencies { classpath('com.android.tools.build:gradle:3.6.0-rc02') classpath 'com.google.gms:google-services:4.3.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { 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") } maven { // Required for react-native-background-geolocation url("${project(':react-native-background-geolocation-android').projectDir}/libs") } maven { // Required for react-native-background-fetch url("${project(':react-native-background-fetch').projectDir}/libs") } maven { url "https://www.jitpack.io" } google() jcenter() maven { url 'https://jitpack.io' } } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' apply plugin: "com.android.application" apply from: "$rootDir/app/versioning-helpers.gradle" 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.keystore 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.keystore) * // 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.keystore mode * jsBundleDirRelease: "$buildDir/intermediates/assets/release.keystore", * * // 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.keystore mode * resourcesDirRelease: "$buildDir/intermediates/res/merged/release.keystore", * * // 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: [] * ] */ buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]' } } project.ext.react = [ entryFile: "index.js", enableHermes: false, bundleInDevDebug: true, bundleInDevRelease: true, bundleInLocalDebug: true, bundleInLocalRelease: true, bundleInProdDebug: true, bundleInProdRelease: true, bundleInStagingDebug: true, bundleInStagingRelease: true, bundleInQaDebug: true, bundleInQaRelease: true, devDisabledInStagingDebug: true, root: "../../" ] project.ext.sentryCli = [ logLevel: 'debug', flavorAware: true, ] apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/@sentry/react-native/sentry.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 = false /** * Run Proguard to shrink the Java bytecode in release.keystore 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 buildToolsVersion rootProject.ext.buildToolsVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "com.vcheck24" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode readVersionCode() versionName readVersionName() missingDimensionStrategy 'react-native-camera', 'general' multiDexEnabled true } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { ... } release { ... } } 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 minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } flavorDimensions 'version' productFlavors { local { applicationIdSuffix ".local" } dev { applicationIdSuffix ".dev" } qa { applicationIdSuffix ".qa" } staging { applicationIdSuffix ".staging" } prod { } } // applicationVariants are e.g. debug, release.keystore 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.keystore variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } 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' } } dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules // Firebase implementation 'com.google.firebase:firebase-analytics:17.2.0' // Sentry - Native module for crash reporting implementation 'io.sentry:sentry-android:1.7.30' if (enableHermes) { def hermesPath = "../../node_modules/hermesvm/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.keystore.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' } // Fastlane task doMajorVersionIncrement { doLast { println "Incrementing major version..." incrementVersionNumber('major') } } task doMinorVersionIncrement { doLast { println "Incrementing minor version..." incrementVersionNumber('minor') } } task doPatchVersionIncrement { doLast { println "Incrementing patch version..." incrementVersionNumber('patch') } } task doBuildNumberUpdate { doLast { println "Updating build number..." updateBuildNumber() } } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) Project background_geolocation = project(':react-native-background-geolocation-android') apply from: "${background_geolocation.projectDir}/app.gradle" apply plugin: 'com.google.gms.google-services ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'VCheck24' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' ``` #### `MainApplication.java`: ```java package com.vcheck24; import android.app.Application; import com.facebook.react.BuildConfig; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
packages.add(new FrontCameraPackage());
packages.add(new MemoryPackage());
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);
}
}
```
#### `AndroidManifest.xml`:
```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 10.15.5 CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz Memory: 34.57 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node Yarn: 1.19.1 - ~/.yarn/bin/yarn npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 23, 24, 25, 26, 27, 28, 29 Build Tools: 27.0.3, 28.0.2, 28.0.3, 29.0.1, 29.0.2 System Images: android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.6 AI-192.7142.36.36.6165589 Xcode: 11.5/11E608c - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 ``` - **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:** - 6.3.4 - **`Firebase` module(s) you're using that has the issue:** - Firestore - **Are you using `TypeScript`?** - N
React Native Firebase
andInvertase
on Twitter for updates on the library.