Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading RN version 0.67.2 (react 17.0.2) to RN version 0.70.12 (react 18.1.0) breaks the build #243

Open
1 task done
acfadmin opened this issue Jul 30, 2023 · 0 comments

Comments

@acfadmin
Copy link

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600K
    Memory: 18.86 GB / 31.78 GB
  Binaries:
    Node: 16.20.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.4 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: AI-222.4459.24.2221.10121639
    Visual Studio: 17.5.33516.290 (Visual Studio Community 2022)
  Languages:
    Java: 11.0.18 - C:\Program Files\Microsoft\jdk-11.0.18.10-hotspot\bin\javac.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: ^0.70.0 => 0.70.13
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Things I’ve done to figure out my issue

Steps followed --

  1. Ran npx react-native upgrade 0.70.12
  2. Ran npx @rnx-kit/align-deps --requirements react-native@0.70.12 followed by npx @rnx-kit/align-deps --requirements react-native@0.70.12 --write
  3. Followed all changes given at https://react-native-community.github.io/upgrade-helper/?from=0.67.2&to=0.70.12
  4. Normal cleaning rebuilding - Deleting node_modules followed by running yarn and then gradlew clean

Extra notes --

  1. I am using "rn-nodeify": "^10.3.0" and thus after yan i use ./node_modules/.bin/rn-nodeify --hack --install --yarn

Upgrading version

RN version 0.70.12 (react 18.1.0)

Description

Now when i run gradlew assembleRelease it throws various errors. I tried everything i could on Stakcoverflow but hasnt helped.

E:\Alien Chicken Farm\acfmobile\node_modules\react-native-os\android\src\main\java\com\peel\react\RNOS.java:15: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.Arguments;
                                ^
E:\Alien Chicken Farm\acfmobile\node_modules\react-native-os\android\src\main\java\com\peel\react\RNOS.java:16: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.LifecycleEventListener;
                                ^
E:\Alien Chicken Farm\acfmobile\node_modules\react-native-os\android\src\main\java\com\peel\react\RNOS.java:17: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.ReactApplicationContext;
                         ^

AND

36 errors

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-os:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 19s

    at makeError (E:\Alien Chicken Farm\acfmobile\node_modules\execa\index.js:174:9)
    at E:\Alien Chicken Farm\acfmobile\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (E:\Alien Chicken Farm\acfmobile\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (E:\Alien Chicken Farm\acfmobile\node_modules\@react-native-community\cli\build\index.js:142:9)

Reproducible demo

package.json
{
"name": "acfmobile",
"version": "0.0.1",
"private": true,
"scripts": {
  "android": "react-native run-android -- --warning-mode=all",
  "ios": "react-native run-ios",
  "start": "react-native start --reset-cache",
  "test": "jest",
  "lint": "eslint ."
},
"dependencies": {
  "@metaplex-foundation/js": "^0.19.4",
  "@metaplex-foundation/mpl-token-metadata": "^2.13.0",
  "@project-serum/anchor": "^0.20.1",
  "@project-serum/sol-wallet-adapter": "^0.2.6",
  "@project-serum/swap-ui": "^0.2.5",
  "@react-native-async-storage/async-storage": "^1.17.10",
  "@react-native-clipboard/clipboard": "^1.10.0",
  "@react-native-picker/picker": "^2.4.10",
  "@react-navigation/native": "^6.0.8",
  "@react-navigation/native-stack": "^6.4.1",
  "@solana/spl-token": "^0.3.8",
  "@solana/spl-token-registry": "^0.2.4574",
  "@solana/wallet-adapter-base": "^0.9.22",
  "@solana/web3.js": "^1.78.0",
  "@tradle/react-native-http": "^2.0.0",
  "assert": "^1.1.1",
  "big-integer": "^1.6.51",
  "bip32": "^3.0.1",
  "bip39": "^3.0.4",
  "browserify-zlib": "~0.1.4",
  "buffer": "^4.9.1",
  "console-browserify": "^1.1.0",
  "constants-browserify": "^1.0.0",
  "dns.js": "^1.0.1",
  "domain-browser": "^1.1.1",
  "ed25519-hd-key": "^1.2.0",
  "events": "^1.0.0",
  "https-browserify": "~0.0.0",
  "path-browserify": "0.0.0",
  "process": "^0.11.0",
  "punycode": "^1.2.4",
  "querystring-es3": "~0.2.0",
  "react": "18.1.0",
  "react-native": "^0.70.0",
  "react-native-biometrics": "^2.1.4",
  "react-native-crypto": "^2.2.0",
  "react-native-keychain": "^8.0.0",
  "react-native-level-fs": "^3.0.0",
  "react-native-onesignal": "^4.3.7",
  "react-native-os": "^1.2.6",
  "react-native-qrcode-svg": "^6.1.2",
  "react-native-randombytes": "^3.6.1",
  "react-native-responsive-dimensions": "^3.1.1",
  "react-native-safe-area-context": "^4.4.1",
  "react-native-screens": "^3.18.2",
  "react-native-size-matters": "^0.4.0",
  "react-native-snap-carousel": "yadigarbz/react-native-snap-carousel#df1ec4da3194eb20ffb797270b971a33b3ae6d72",
  "react-native-status-bar-height": "^2.6.0",
  "react-native-svg": "^12.3.0",
  "react-native-tcp": "^3.2.1",
  "react-native-toast-message": "^2.1.1",
  "react-native-udp": "^4.1.7",
  "react-native-url-polyfill": "^1.3.0",
  "react-native-webview": "^11.23.0",
  "readable-stream": "1.0.33",
  "rn-nodeify": "^10.3.0",
  "stream-browserify": "^1.0.0",
  "string_decoder": "~0.10.25",
  "timers-browserify": "^1.0.1",
  "tty-browserify": "0.0.0",
  "url": "~0.10.1",
  "util": "~0.10.3",
  "vm-browserify": "0.0.4"
},
"devDependencies": {
  "@babel/core": "^7.12.9",
  "@babel/plugin-external-helpers": "^7.22.5",
  "@babel/plugin-proposal-numeric-separator": "^7.18.6",
  "@babel/preset-env": "^7.22.9",
  "@babel/preset-react": "^7.22.5",
  "@babel/runtime": "^7.12.5",
  "@react-native-community/eslint-config": "^2.0.0",
  "babel-jest": "^26.6.3",
  "babel-plugin-rewrite-require": "^1.14.5",
  "eslint": "^7.32.0",
  "jest": "^26.6.3",
  "jetifier": "^2.0.0",
  "metro-react-native-babel-preset": "^0.72.1",
  "react-test-renderer": "18.1.0"
},
"jest": {
  "preset": "react-native"
},
"react-native": {
  "zlib": "browserify-zlib",
  "console": "console-browserify",
  "constants": "constants-browserify",
  "crypto": "react-native-crypto",
  "dns": "dns.js",
  "net": "react-native-tcp",
  "domain": "domain-browser",
  "http": "@tradle/react-native-http",
  "https": "https-browserify",
  "os": "react-native-os",
  "path": "path-browserify",
  "querystring": "querystring-es3",
  "fs": "react-native-level-fs",
  "_stream_transform": "readable-stream/transform",
  "_stream_readable": "readable-stream/readable",
  "_stream_writable": "readable-stream/writable",
  "_stream_duplex": "readable-stream/duplex",
  "_stream_passthrough": "readable-stream/passthrough",
  "dgram": "react-native-udp",
  "stream": "stream-browserify",
  "timers": "timers-browserify",
  "tty": "tty-browserify",
  "vm": "vm-browserify",
  "tls": false
},
"browser": {
  "zlib": "browserify-zlib",
  "console": "console-browserify",
  "constants": "constants-browserify",
  "crypto": "react-native-crypto",
  "dns": "dns.js",
  "net": "react-native-tcp",
  "domain": "domain-browser",
  "http": "@tradle/react-native-http",
  "https": "https-browserify",
  "os": "react-native-os",
  "path": "path-browserify",
  "querystring": "querystring-es3",
  "fs": "react-native-level-fs",
  "_stream_transform": "readable-stream/transform",
  "_stream_readable": "readable-stream/readable",
  "_stream_writable": "readable-stream/writable",
  "_stream_duplex": "readable-stream/duplex",
  "_stream_passthrough": "readable-stream/passthrough",
  "dgram": "react-native-udp",
  "stream": "stream-browserify",
  "timers": "timers-browserify",
  "tty": "tty-browserify",
  "vm": "vm-browserify",
  "tls": false
}
}
android/app/build.gradle
buildscript {
  repositories {
      gradlePluginPortal()
  }
  dependencies {
      classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
  }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os

/**
* 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 = [
  enableHermes: true,  // clean and rebuild if changing
  entryFile: "index.js" // was index.js"
]

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 = 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 that value will be read 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);

/**
* Architectures to build native code for.
*/
def reactNativeArchitectures() {
  def value = project.getProperties().get("reactNativeArchitectures")
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {
  ndkVersion rootProject.ext.ndkVersion

  compileSdkVersion rootProject.ext.compileSdkVersion

  defaultConfig {
      applicationId "com.acfmobile"
      minSdkVersion rootProject.ext.minSdkVersion
      targetSdkVersion rootProject.ext.targetSdkVersion
      versionCode 5
      versionName "1.0.4"
      
      buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
      if (isNewArchitectureEnabled()) {
          // We configure the CMake build only if you decide to opt-in for the New Architecture.
          externalNativeBuild {
              cmake {
                  arguments "-DPROJECT_BUILD_DIR=$buildDir",
                      "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
                      "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
                      "-DNODE_MODULES_DIR=$rootDir/../node_modules",
                      "-DANDROID_STL=c++_shared"
              }
          }
          if (!enableSeparateBuildPerCPUArchitecture) {
              ndk {
                  abiFilters (*reactNativeArchitectures())
              }
          }
      }
  }

  
  if (isNewArchitectureEnabled()) {
      // We configure the NDK build only if you decide to opt-in for the New Architecture.
      externalNativeBuild {
          cmake {
              path "$projectDir/src/main/jni/CMakeLists.txt"
          }
      }
      def reactAndroidProjectDir = project(':ReactAndroid').projectDir
      def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
          dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
          from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
          into("$buildDir/react-ndk/exported")
      }
      def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
          dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
          from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
          into("$buildDir/react-ndk/exported")
      }
      afterEvaluate {
          // If you wish to add a custom TurboModule or component locally,
          // you should uncomment this line.
          // preBuild.dependsOn("generateCodegenArtifactsFromSchema")
          preDebugBuild.dependsOn(packageReactNdkDebugLibs)
          preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
          // Due to a bug inside AGP, we have to explicitly set a dependency
          // between configureCMakeDebug* tasks and the preBuild tasks.
          // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
          configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
          configureCMakeDebug.dependsOn(preDebugBuild)
          reactNativeArchitectures().each { architecture ->
              tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
                  dependsOn("preDebugBuild")
              }
              tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
                  dependsOn("preReleaseBuild")
              }
          }
      }
  }

  splits {
      abi {
          reset()
          enable enableSeparateBuildPerCPUArchitecture
          universalApk false  // If true, also generate a universal APK
          include (*reactNativeArchitectures())
      }
  }
  signingConfigs {
      debug {
          storeFile file('debug.keystore')
          storePassword 'android'
          keyAlias 'androiddebugkey'
          keyPassword 'android'
      }
      release {
          if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
              storeFile file(MYAPP_UPLOAD_STORE_FILE)
              storePassword MYAPP_UPLOAD_STORE_PASSWORD
              keyAlias MYAPP_UPLOAD_KEY_ALIAS
              keyPassword MYAPP_UPLOAD_KEY_PASSWORD
          }
      }
  }
  
  lintOptions {
      checkReleaseBuilds false
  }

  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, "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 =
                      defaultConfig.versionCode * 1000 + versionCodes.get(abi)
          }

      }
  }
}

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

  //noinspection GradleDynamicVersion
  implementation "com.facebook.react:react-native:0.70.12"  // From node_modules
  implementation platform('com.google.firebase:firebase-bom:29.2.1')
  implementation 'com.google.firebase:firebase-analytics'

  implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.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) {
      //noinspection GradleDynamicVersion
      implementation("com.facebook.react:hermes-engine:+") { // From node_modules
          exclude group:'com.facebook.fbjni'
      }
  } else {
      implementation jscFlavor
  }
}


if (isNewArchitectureEnabled()) {
  // If new architecture is enabled, we let you build RN from source
  // Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
  // This will be applied to all the imported transtitive dependency.
  configurations.all {
      resolutionStrategy.dependencySubstitution {
          substitute(module("com.facebook.react:react-native"))
                  .using(project(":ReactAndroid"))
                  .because("On New Architecture we're building React Native from source")
          substitute(module("com.facebook.react:hermes-engine"))
                  .using(project(":ReactAndroid:hermes-engine"))
                  .because("On New Architecture we're building Hermes from source")
      }
  }
}


// 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.implementation
  into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)


def isNewArchitectureEnabled() {
  // To opt-in for the New Architecture, you can either:
  // - Set `newArchEnabled` to true inside the `gradle.properties` file
  // - Invoke gradle with `-newArchEnabled=true`
  // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
  return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

buildscript {
  ext {
      buildToolsVersion = "33.0.0"
      minSdkVersion = 23
      compileSdkVersion = 33
      targetSdkVersion = 33
      if (System.properties['os.arch'] == "aarch64") {
          // For M1 Users we need to use the NDK 24 which added support for aarch64
          ndkVersion = "24.0.8215888"
      } else {
          // Otherwise we default to the side-by-side NDK version from AGP.
          ndkVersion = "21.4.7075529"
      }
      kotlinVersion = "1.6.21"
  }
  repositories {
      google()
      mavenCentral()
  }
  dependencies {
      classpath("com.android.tools.build:gradle:7.2.1")
      classpath("com.facebook.react:react-native-gradle-plugin")
      classpath("de.undercouch:gradle-download-task:5.0.1")
      classpath 'com.google.gms:google-services:4.3.10'

      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
      
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
      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")
      }
      mavenCentral {
          // We don't want to fetch react-native from Maven Central as there are
          // older versions over there.
          content {
              excludeGroup "com.facebook.react"
          }
      }
      google()
      maven { url 'https://www.jitpack.io' }
  }
  
  configurations.all {
      resolutionStrategy {
          force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
      }
  }
}

// got an error and then referred - https://stackoverflow.com/questions/72121282/how-to-fix-the-error-could-not-find-method-compile-for-arguments-directory 
subprojects { subproject ->
      if(project['name'] == 'react-native-os' || project['name'] == 'react-native-tcp'){
          project.configurations { compile { } }
      }
}

android/gradle.properties
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -XX:ThreadStackSize=4096 -XX:CompilerThreadStackSize=4096
org.gradle.jvmargs=-Xmx2048m -Xms2048m -XX:MaxMetaspaceSize=512m -XX:ThreadStackSize=4096 -XX:CompilerThreadStackSize=4096

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.125.0
# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false

MYAPP_UPLOAD_STORE_FILE=release.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=admin@1234
MYAPP_UPLOAD_KEY_PASSWORD=admin@1234

android/settings.gradle
rootProject.name = 'acfmobile'
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
  include(":ReactAndroid")
  project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
  include(":ReactAndroid:hermes-engine")
  project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant