Open Gnanesh009 opened 1 year ago
Got the same error
Me too. :(
Not sure why this happened; but now the Java function seems to want a boolean for the last parameter to indicate getConcurrentReactEnabled, in the MainActivity.java.
The comment before already suggested that was needed, anyway, this is how to change it:
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(
this,
getMainComponentName()
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
DefaultNewArchitectureEntryPoint.getFabricEnabled(),
);
}
To this:
/**
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
* (aka React 18) with two boolean flags.
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(
this,
getMainComponentName(),
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
);
}
Yeah it should conform to the class defined here: https://github.com/facebook/react-native/blob/v0.71.14/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt#L25-L30
^ Insert the appropriate RN version number for your project
MainActivity.java:26: error: constructor DefaultReactActivityDelegate in class DefaultReactActivityDelegate cannot be applied to given types;
return new DefaultReactActivityDelegate( ^ required: ReactActivity,String,boolean,boolean found: MainActivity,String,boolean reason: actual and formal argument lists differ in length 1 error
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Try:
2: Task failed with an exception.
What went wrong: java.lang.StackOverflowError (no error message)
Try:
Get more help at https://help.gradle.org
BUILD FAILED in 11s
info Fetching system and libraries information... System: OS: Windows 10 10.0.22621 CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz Memory: 2.61 GB / 15.71 GB Binaries: Node: 18.16.1 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Android NDK: 22.1.7171670 Windows SDK: AllowDevelopmentWithoutDevLicense: Enabled IDEs: Android Studio: AI-222.4459.24.2221.10121639 Visual Studio: Not Found Languages: Java: 11.0.19 npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: ^0.71.1 => 0.71.1 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found
my android/build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 kotlinVersion = "1.5.31" // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. ndkVersion = "23.1.7779620" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") } }
my android/app/buil.gradle
apply plugin: "com.android.application" apply plugin: "com.facebook.react"
/**
By default you don't need to apply any configuration, just uncomment the lines you need. / react { / Folders */ // The root of your project, i.e. where "package.json" lives. Default is '..' // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native // reactNativeDir = file("../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen // codegenDir = file("../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js // cliFile = file("../node_modules/react-native/cli.js")
/ Variants / // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"]
/ Bundling / // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = []
/ Hermes Commands / // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] }
/**
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
andString.localeCompare
thatandroid { ndkVersion rootProject.ext.ndkVersion
}
dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android")
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
my gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
packages.json
"dependencies": { "@react-native-async-storage/async-storage": "^1.19.3", "@react-native-camera-roll/camera-roll": "^5.7.2", "@react-native-community/geolocation": "^3.1.0", "@react-native-community/netinfo": "^9.4.1", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "^6.9.13", "i18next": "^23.5.1", "react": "18.2.0", "react-i18next": "^13.2.2", "react-native": "^0.71.1", "react-native-base64": "^0.2.1", "react-native-chart-kit": "^6.12.0", "react-native-elements": "^3.4.3", "react-native-image-crop-picker": "^0.40.0", "react-native-reanimated": "^2.14.4", "react-native-responsive-screen": "^1.4.2", "react-native-safe-area-context": "^4.6.3", "react-native-screens": "^3.20.0", "react-native-select-dropdown": "^3.4.0", "react-native-share": "^9.4.1", "react-native-svg": "^13.13.0", "react-native-svg-transformer": "^1.1.0", "react-native-vector-icons": "^10.0.0", "react-native-view-shot": "^3.0.2", "react-redux": "^8.1.2", "redux-thunk": "^2.4.2" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.11", "@tsconfig/react-native": "^3.0.0", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.8", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "typescript": "4.8.4" },
jdk version is 11