ramesh khadka
ramesh khadka

Reputation: 71

Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

I am new to react-native development. I was trying a simple react-native project from Facebook git hub. I have followed all the steps but when I try to run the project by typing

  react-native run-android

it simply shows me following error:

   info Running jetifier to migrate libraries to AndroidX. You can  disable it using "--no-jetifier" flag.
   Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
   info Starting JS server...
   info Launching emulator...
   info Successfully launched emulator.
   info Installing the app...
   Warning: No leading - on line 1 of `C:\Program Files\Java\jdk-13\lib\jvm.cfg'

   error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
   Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
   Warning: No leading - on line 1 of `C:\Program Files\Java\jdk-13\lib\jvm.cfg'

at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (C:\Users\Toshiba\Documents\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Users\Toshiba\Documents\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)

Upvotes: 3

Views: 15566

Answers (4)

Kundan Dewangan
Kundan Dewangan

Reputation: 71

The error message you encountered suggests that there was a problem configuring the project ':rn-fetch-blob' in React Native when running the './gradlew clean' command. Specifically, it mentions that it could not load compiled classes for the build file located at 'D:\D-drive\mobile\mkc-student-app\node_modules\rn-fetch-blob\android\build.gradle' from the cache.

To resolve this issue, you can try the following steps:

1. Make sure you have a stable internet connection.

2. Delete the Gradle cache by navigating to the following directory:

  • For Windows: C:\Users<your_username>.gradle\caches
  • For macOS: /Users/<your_username>/.gradle/caches
  • For Linux: /home/<your_username>/.gradle/caches

3. After deleting the cache, run the './gradlew clean' command again.

Upvotes: 0

kk007
kk007

Reputation: 1

If you're using the latest version of Java Development Kit, you'll need to change the Gradle version of your project so it can recognize the JDK. You can do that by going to {project root folder}\android\gradle\wrapper\gradle-wrapper.properties and changing the distributionUrl value to upgrade the Gradle version. You can check out here the lastest releases of Gradle

Upvotes: 0

ramesh khadka
ramesh khadka

Reputation: 71

Turns out I had a problem with my Java. I uninstall JDK and JRE and reinstall the latest version and it worked out for me.

Upvotes: 3

Gaurav Roy
Gaurav Roy

Reputation: 12205

Try these once :

1.reopen android studio as admin. build the gradle. if no issue, proceed on
access the android folder of your app. i.e c:\folder\app\android
2.type in gradlew clean
3.run react-native run-android

Hope it helps

Upvotes: 0

Related Questions