Closed kamal-j closed 2 years ago
Fixed this by removing
include ':@react-native-firebase_app'
project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android')
from android/settings.gradle
Issue
I'm getting the following error when I try to do release build for android.
Describe your issue here
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "dstreet-frontend", "version": "0.0.0", "license": "MIT", "scripts": { "start": "nx serve", "build": "nx build", "test": "nx test", "prepare": "husky install" }, "private": true, "dependencies": { "@babel/preset-react": "^7.17.12", "@nrwl/nx-cloud": "^14.1.2", "@react-native-async-storage/async-storage": "^1.15.5", "@react-native-clipboard/clipboard": "^1.10.0", "@react-native-community/blur": "^3.6.0", "@react-native-community/datetimepicker": "^4.0.1", "@react-native-community/masked-view": "^0.1.11", "@react-native-community/netinfo": "^8.0.0", "@react-native-firebase/analytics": "^15.0.0", "@react-native-firebase/app": "^15.0.0", "@react-native-firebase/auth": "^15.0.0", "@react-native-firebase/crashlytics": "^15.0.0", "@react-native-firebase/database": "^15.0.0", "@react-native-firebase/dynamic-links": "^15.0.0", "@react-native-firebase/in-app-messaging": "^15.0.0", "@react-native-firebase/messaging": "^15.0.0", "@react-native-google-signin/google-signin": "^7.0.1", "@react-navigation/bottom-tabs": "^6.0.7", "@react-navigation/devtools": "^6.0.4", "@react-navigation/drawer": "^6.1.6", "@react-navigation/material-top-tabs": "^6.1.1", "@react-navigation/native": "^6.0.4", "@react-navigation/native-stack": "^6.2.5", "@reduxjs/toolkit": "^1.6.0", "@sentry/react-native": "^3.4.1", "@thecodingmachine/redux-toolkit-wrapper": "2.0.1", "@twotalltotems/react-native-otp-input": "^1.3.11", "add": "^2.0.6", "appcenter": "^4.4.3", "appcenter-analytics": "^4.4.3", "appcenter-cli": "^2.10.8", "appcenter-crashes": "^4.4.3", "axios": "^0.21.1", "base64-arraybuffer": "^1.0.1", "core-js": "^3.6.5", "date-fns": "^2.28.0", "dotenv": "^16.0.1", "fetch-intercept": "^2.4.0", "fuse.js": "^6.5.3", "fuzzysort": "^1.1.4", "highcharts": "^10.1.0", "highcharts-react-official": "^3.1.0", "immutability-helper": "^3.1.1", "link-preview-js": "^2.1.13", "lodash": "^4.17.21", "lottie-react-native": "^5.1.3", "mixpanel-react-native": "^1.3.4", "moment": "^2.29.1", "native-base": "3.3.5", "patch-package": "^6.4.7", "path": "^0.12.7", "postinstall-postinstall": "^2.1.0", "profanity-hindi": "^1.1.0", "prop-types": "^15.7.2", "react": "17.0.1", "react-dom": "18.0.0", "react-hook-form": "^7.18.1", "react-native": "0.67.2", "react-native-background-timer": "^2.4.1", "react-native-code-push": "^7.0.4", "react-native-collapsible": "^1.6.0", "react-native-collapsible-tab-view": "^4.5.2", "react-native-device-info": "^8.7.0", "react-native-dotenv": "^3.3.1", "react-native-easy-content-loader": "^0.3.2", "react-native-encrypted-storage": "^4.0.2", "react-native-exception-handler": "^2.10.10", "react-native-fast-image": "^8.5.8", "react-native-flipper": "^0.143.0", "react-native-fs": "^2.18.0", "react-native-gesture-handler": "^1.10.3", "react-native-head-tab-view": "^4.0.0-rc.13", "react-native-highcharts": "https://github.com/pIyUsH00rAj/react-native-highcharts.git", "react-native-image-picker": "^4.8.3", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-linear-gradient": "^2.5.6", "react-native-otp-verify": "^1.0.5", "react-native-pager-view": "^5.4.1", "react-native-parsed-text": "^0.0.22", "react-native-performance": "^2.1.0", "react-native-performance-flipper-reporter": "^2.0.0", "react-native-push-notification": "^8.1.1", "react-native-ratings": "^8.1.0", "react-native-read-more-text": "^1.1.2", "react-native-reanimated": "^2.4.1", "react-native-reanimated-carousel": "^2.3.2", "react-native-render-html": "^6.3.4", "react-native-responsive-dimensions": "^3.1.1", "react-native-restart": "0.0.22", "react-native-safe-area-context": "^3.3.0", "react-native-screens": "^3.10.1", "react-native-snap-carousel": "^3.9.1", "react-native-step-indicator": "^1.0.3", "react-native-svg": "^12.3.0", "react-native-tab-view": "2.16.0", "react-native-tab-view-collapsible-header": "^2.0.1", "react-native-vector-icons": "8.1.0", "react-native-video": "^5.2.0", "react-native-video-controls": "^2.8.1", "react-native-web": "^0.17.7", "react-native-web-linear-gradient": "^1.1.2", "react-native-web-lottie": "^1.4.4", "react-native-webview": "^11.18.2", "react-navigation-material-bottom-tabs": "^2.3.4", "react-number-format": "^4.9.3", "react-redux": "^7.2.4", "react-router-dom": "5.3.0", "react-scripts": "^5.0.1", "redux": "^4.1.0", "redux-persist": "^6.0.0", "regenerator-runtime": "0.13.7", "rollbar-react-native": "^0.9.2", "styled-components": "^5.3.1", "styled-system": "^5.1.5", "tslib": "^2.0.0", "victory-native": "^36.2.0", "web-vitals": "^2.1.4", "wretch": "^1.7.10" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@commitlint/cli": "^17.0.0", "@commitlint/config-conventional": "^17.0.0", "@craco/craco": "^6.4.3", "@nrwl/cli": "13.10.3", "@nrwl/cypress": "13.10.4", "@nrwl/eslint-plugin-nx": "13.10.3", "@nrwl/jest": "13.10.3", "@nrwl/linter": "13.10.3", "@nrwl/react": "13.10.4", "@nrwl/react-native": "^13.10.3", "@nrwl/web": "13.10.3", "@nrwl/workspace": "13.10.3", "@react-native-async-storage/async-storage": "^1.15.5", "@react-native-community/cli": "7.0.1", "@react-native-community/cli-platform-android": "7.0.1", "@react-native-community/cli-platform-ios": "7.0.1", "@react-native-community/eslint-config": "^2.0.0", "@react-navigation/devtools": "^6.0.4", "@svgr/webpack": "^6.2.1", "@testing-library/jest-dom": "^5.16.4", "@testing-library/jest-native": "4.0.4", "@testing-library/react": "13.0.0", "@testing-library/react-hooks": "7.0.2", "@testing-library/react-native": "9.1.0", "@types/jest": "27.0.2", "@types/node": "16.11.7", "@types/react": "18.0.0", "@types/react-dom": "18.0.0", "@types/react-native": "0.67.3", "@types/react-router-dom": "5.3.3", "@typescript-eslint/eslint-plugin": "~5.18.0", "@typescript-eslint/parser": "~5.18.0", "babel-jest": "27.2.3", "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-react-native-web": "^0.17.7", "babel-plugin-transform-remove-console": "^6.9.4", "cypress": "^9.1.0", "eslint": "~8.12.0", "eslint-config-prettier": "8.1.0", "eslint-config-react-app": "^7.0.1", "eslint-import-resolver-babel-module": "^5.1.2", "eslint-plugin-cypress": "^2.10.3", "eslint-plugin-import": "2.26.0", "eslint-plugin-jest": "^24.3.5", "eslint-plugin-jsx-a11y": "6.5.1", "eslint-plugin-react": "7.29.4", "eslint-plugin-react-hooks": "4.4.0", "husky": "^8.0.1", "identity-obj-proxy": "^3.0.0", "jest": "27.2.3", "jest-react-native": "18.0.0", "metro": "0.70.0", "metro-react-native-babel-preset": "0.70.0", "metro-resolver": "0.70.0", "nx": "13.10.3", "prettier": "^2.5.1", "react-native-config": "1.4.5", "react-native-flipper": "^0.143.0", "react-native-performance": "^2.1.0", "react-native-performance-flipper-reporter": "^2.0.0", "react-native-svg": "^12.3.0", "react-native-svg-transformer": "1.0.0", "react-native-test-app": "^1.3.5", "react-test-renderer": "17.0.2", "redux-flipper": "^1.4.2", "ts-jest": "27.0.5", "typescript": "~4.6.2" } } ``` #### `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 # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```
Android
Click To Expand
#### Have you converted to AndroidX? - [x] 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`: ```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 23 compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "20.1.5948944" } repositories { google() jcenter() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle:4.1.0") classpath("com.google.gms:google-services:4.3.10") classpath("com.google.firebase:firebase-crashlytics-gradle:2.8.1") // 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") } google() jcenter() mavenCentral() maven { url 'https://www.jitpack.io' } } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.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. If none specified and * // "index.android.js" exists, it will be used. Otherwise "index.js" is * // default. Can be overridden with ENTRY_FILE environment variable. * entryFile: "index.android.js", * * // https://reactnative.dev/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: "apps/mobile-df/index.js", enableHermes: true, // clean and rebuild if changing bundleInDebug: true, ] apply from: "../../node_modules/react-native/react.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 = true /** * 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 { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "com.dstreetfinance" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()) } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a" } } signingConfigs { release { storeFile file(project.env.get("SIGNING_STORE_FILE")) storePassword project.env.get("SIGNING_STORE_PASSWORD") keyAlias project.env.get("SIGNING_KEY_ALIAS") keyPassword project.env.get("SIGNING_KEY_PASSWORD") } debug { storeFile file(project.env.get("SIGNING_STORE_FILE")) storePassword project.env.get("SIGNING_STORE_PASSWORD") keyAlias project.env.get("SIGNING_KEY_ALIAS") keyPassword project.env.get("SIGNING_KEY_PASSWORD") } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.release 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 // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = defaultConfig.versionCode * 1000 + versionCodes.get(abi) } } } } dependencies { // For animated GIF support // implementation 'com.facebook.fresco:animated-gif:2.6.0' implementation fileTree(dir: "libs", include: ["*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:0.67.2" // From node_modules implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" // Import the BoM for the Firebase platform implementation platform('com.google.firebase:firebase-bom:29.0.2') // Declare the dependency for the Firebase Authentication library // When using the BoM, you don't specify versions in Firebase library dependencies implementation 'com.google.firebase:firebase-auth' implementation 'com.google.firebase:firebase-inappmessaging-display' implementation 'com.google.firebase:firebase-dynamic-links' implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-messaging:17.6.0' // Also declare the dependency for the Google Play services library and specify its version implementation 'com.google.android.gms:play-services-auth:20.0.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 'com.google.android.material:material:1.1.0' implementation 'com.google.android.play:core:1.7.3' } // 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 from: "../../node_modules/react-native-vector-icons/fonts.gradle" apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'Dstreet Finance' include ':react-native-video' project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-video/android') include ':react-native-video' project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-video/android') include ':react-native-config' project(':react-native-config').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-config/android') include ':react-native-webview' project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android') include ':@react-native-firebase_app' project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') include ':app' ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 12.3.1 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 99.85 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 17.9.0 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.5.5 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7678000 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 17.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: * => 17.0.1 react-native: * => 0.67.2 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 - [x] **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`?** - `N`
React Native Firebase
andInvertase
on Twitter for updates on the library.