Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native build failed in android, @react-native-community/cli-platform-android /native_modules.gradle' line: 130

I've upgraded my ReactNative project from 0.59 to 0.61.2 iOS is building fine but in android i'm facing the issue in @react-native-community/cli-platform-android module.

My settings.gradle file

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

My build.gradle file

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

I get the following error while building the app.

> Task :app:generatePackageList FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/Users/yashwanth_c/Documents/projects/MobileApp/node_modules/@react-native-community/cli-platform-android
/native_modules.gradle' line: 130

* What went wrong:
Execution failed for task ':app:generatePackageList'.
> ReactNativeModules$_generatePackagesFile_closure3

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5m 21s
4 actionable tasks: 4 executed

As always i've cleaned the cache and deleted the node_module folder, tried many times but no luck. Also googled for more than a week but still not able to find a fix, any advice is appreciated.

like image 433
Yashwanth Avatar asked Dec 20 '19 09:12

Yashwanth


Video Answer


3 Answers

I had same issues then i tried below command. it's worked for me. It's mean, mannually install the android cli package.

npm i @react-native-community/cli-platform-android

If anyone known another solution kindly share here.

like image 86
Elavarasan r Avatar answered Oct 19 '22 10:10

Elavarasan r


I'm working in a monorepo. The file exists, but it was in my project root's node_modules/@react-native-community NOT the package node_modules.

To fix this, I updated the paths

/android/settings.gradle : Line 2

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

/android/app/build.gradle : Line 225

apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
like image 41
radihuq Avatar answered Oct 19 '22 10:10

radihuq


I was facing the same issue in React Native 0.61.0. I have tried the below solution:-

  1. Closed the Android studio.
  2. cd android
  3. ./gradlew --stop (in MacOS)
  4. ./gradlew cleanBuildCache (in MacOS)

For Window:-

  1. gradlew --stop
  2. gradlew cleanBuildCache

Check below linking for more reference https://github.com/react-native-community/cli/issues/591

like image 13
Pankaj Negi Avatar answered Oct 19 '22 11:10

Pankaj Negi