Repository navigation
Description
Ask your Question
I'm getting issue
FAILURE: Build failed with an exception.
-
Where:
Script '/Volumes/DATA/LIVE_PROJECT/project_name/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 420 -
What went wrong:
A problem occurred evaluating script.
Command '[node, /Volumes/DATA/LIVE_PROJECT/project_name/node_modules/@react-native-community/cli/build/bin.js, config, --platform, android]' failed with exit code 1.
Caused by: java.lang.Exception: Command '[node, /Volumes/DATA/LIVE_PROJECT/project_name/GIT/project_name/node_modules/@react-native-community/cli/build/bin.js, config, --platform, android]' failed with exit code 1.
"dependencies": {
"@expo/react-native-action-sheet": "4.0.1",
"@microsoft/signalr": "7.0.10",
"@pusher/pusher-websocket-react-native": "1.1.0",
"@react-native-async-storage/async-storage": "1.17.10",
"@react-native-community/cli-platform-android": "^14.0.0",
"@react-native-community/netinfo": "9.0.0",
"@react-native-community/push-notification-ios": "1.10.1",
"@react-native-firebase/app": "18.6.1",
"@react-native-firebase/crashlytics": "18.6.1",
"@react-native-firebase/messaging": "18.6.1",
"@react-native-google-signin/google-signin": "10.0.1",
"@react-navigation/bottom-tabs": "6.4.0",
"@react-navigation/material-bottom-tabs": "6.2.4",
"@react-navigation/native": "6.0.13",
"@react-navigation/stack": "6.3.2",
"@sanar/react-native-highlight-text": "1.0.2",
"@sentry/react-native": "4.6.1",
"@starling-tech/ripple-touchable": "0.1.5",
"axios": "0.27.2",
"moment": "2.29.4",
"react": "18.1.0",
"react-native": "0.70.2",
"react-native-azure-auth": "1.8.9",
"react-native-bootsplash": "4.3.0",
"react-native-calendars": "1.1290.0",
"react-native-cli": "^2.0.1",
"react-native-code-push": "7.0.5",
"react-native-config": "^1.5.1",
"react-native-country-codes-picker": "2.3.3",
"react-native-date-picker": "4.2.6",
"react-native-device-info": "10.9.0",
"react-native-document-picker": "9.0.1",
"react-native-dropdown-picker": "5.4.2",
"react-native-fast-image": "8.6.1",
"react-native-flash-message": "0.3.1",
"react-native-gesture-handler": "2.12.0",
"react-native-gifted-chat": "2.4.0",
"react-native-gradle-plugin": "^0.71.19",
"react-native-head-tab-view": "4.0.0-rc.13",
"react-native-image-crop-picker": "0.40.0",
"react-native-keyboard-aware-scroll-view": "0.9.5",
"react-native-keychain": "8.1.1",
"react-native-lightbox": "0.8.1",
"react-native-material-menu": "2.0.0",
"react-native-mime-types": "2.4.0",
"react-native-modal": "13.0.1",
"react-native-pager-view": "6.0.1",
"react-native-paper": "4.12.4",
"react-native-permissions": "3.8.4",
"react-native-push-notification": "8.1.1",
"react-native-reanimated": "2.14.4",
"react-native-safe-area-context": "4.5.1",
"react-native-screens": "3.20.0",
"react-native-svg": "13.3.0",
"react-native-tab-view": "3.5.2",
"react-native-tab-view-collapsible-header": "2.0.1",
"react-native-vector-icons": "10.0.0",
"react-native-video": "5.2.1",
"react-native-voip-push-notification": "^3.3.2",
"react-native-webview": "12.0.2",
"react-query": "3.39.2",
"react-signalr": "0.2.17",
"zustand": "4.3.9"
},
"devDependencies": {
"@babel/core": "7.12.9",
"@babel/runtime": "7.12.5",
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"@react-native-community/eslint-config": "3.1.0",
"@rnx-kit/dep-check": "1.13.0",
"@tsconfig/react-native": "2.0.2",
"@types/jest": "26.0.23",
"@types/lodash": "4.14.182",
"@types/react-native": "0.69.3",
"@types/react-native-vector-icons": "6.4.13",
"@types/react-native-video": "5.0.14",
"@types/react-query": "1.2.9",
"@types/react-test-renderer": "18.0.0",
"@typescript-eslint/eslint-plugin": "5.33.0",
"@typescript-eslint/parser": "5.33.0",
"babel-jest": "26.6.3",
"babel-plugin-module-resolver": "4.1.0",
"eslint": "8.21.0",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-babel-module": "5.3.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-react-native": "4.0.0",
"husky": "8.0.1",
"jest": "26.6.3",
"lint-staged": "13.0.1",
"lodash": "4.17.21",
"metro-react-native-babel-preset": "0.72.1",
"patch-package": "6.4.7",
"prettier": "2.7.1",
"react-test-renderer": "18.1.0",
"reactotron-react-native": "5.0.2",
"solidarity": "3.0.4",
"typescript": "4.7.4"
},
node version is 16.20.2
Activity
JedShiMing commentedon Aug 8, 2024
me too
Onibenjo commentedon Aug 9, 2024
I'm facing same issue
mikey94 commentedon Aug 10, 2024
@reactrahul1110 I also got this one. Then i removed "@react-native-community/cli-platform-android": "^14.0.0", from package json and did
npm installagain then i got build succeeded. Also don't forget to clean gradle.Btw- i don't know the exact reason behind this issue.
RamezzE commentedon Aug 10, 2024
I've tried that but it didn't work. I'm having the same issue as well.
I also had the same error which would tell me it was on line 401, but resolved that with path adjustment in settings.gradle, but cannot resolve this one that points to line 420 in native_modules.gradle
GilTRipper commentedon Aug 12, 2024
same issue when using pnpm
JedShiMing commentedon Aug 13, 2024
vishnuvasita21 commentedon Aug 18, 2024
facing same error
tried changing versions, clearing all the cache and re-building and it still is not solved.
Frankenstien97 commentedon Aug 18, 2024
I solved this by removing nvm and installing a node.tar.xz file and setting the path in ~/.profile. Also, a restart to your machine.
Somehow it is not getting the node installed by nvm.
it is working now.
vishnuvasita21 commentedon Aug 18, 2024
I solved my issue by changing the versions to the following
then, cleared the cache of npm and gradle, reinstalled the node module and run
1-
npx expo prebuild --platform android --clean2- ```
cd android
./gradlew assembleDebug --stacktrace --info
Namnp1521 commentedon Aug 20, 2024
any update?
ntv19398 commentedon Aug 21, 2024
downgrade version @react-native-community/cli to 13.6.9 helped me solve the problem. This error appeared when I removed yarn.lock and it updated @react-native-community/cli to 14.0.0 myself.
monasserymcp commentedon Aug 21, 2024
@ntv19398 thanks worked for me
HoaiHuynh commentedon Aug 26, 2024
In my case, I have another package that requires the latest
react-nativeversion, so I addreact-nativeversion into solutions inpackage.jsonSabaa-Abdennabi commentedon Aug 28, 2024
i am facing the same issue , how did you fix it ?
mikey94 commentedon Aug 28, 2024
@Sabaa-Abdennabi
steps I followed -
1). Remove node modules ->
rm -rf node_modules/2). install modules -> npm install
3). clean gradle -> cd android and ./gradlew clean
Then i opened my react native android app using android studio and run build gradle. After that issue got fixed.
my node version -v 20.13.1
npm version - 10.5.2
java version -
Also this is my package json
szymonrybczak commentedon Aug 30, 2024
Hey all! To make all clear let me know provide you steps that are recommended and which are not:
@react-native-community/cliin yourpackage.json, because it can lead to version mismatches and scenarios like this one where some flag is unavailable.--platformflag, you can try running it from root directory of the project:If it fails please check on which CLI version are you using by executing:
If you followed all steps and it's still failing please create a new issue with relevant informations and
package.json. I hope that helps!sniperosx commentedon Sep 26, 2024
For me, it was the same problem after deleting/clearing the
yarn.lock.Thereafter, the
@react-native-community/clihad been upgraded implicitly and made issues in a legacy project (RN 0.70). I discarded the modifiedyarn.lockand looked up the prior version of@react-native-community/cli. For me, it was and way older version of 9.3.2. I put it temporarily as a dev dependency and look: Gradle build is running fine again 👍Not the long-term solution but at least usable for a hotfix release. Think upgrading to newer RN versions and pulling up Gradle as well should solve the problem as well.
Yaya12085 commentedon Oct 1, 2024
I had this problem when deleting my yarn.lock because I use pnpm but I created the
.npmrcfile at the root withnode-linker=hoistedinsidepetragliamateo commentedon Dec 12, 2024
I had this problem and I solved it by manually running the script:
node C:{path_to_your_project}\node_modules@react-native-community\cli\build\bin.js config --platform android
then shows the error, in my case I had to add package={package_name} in the AndroidManifest.xml of react-native-gesture-handler and react-native-maps