最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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: .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-munity\cli-platform-android\build\mands\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-munity\cli\build\index.js:164:9)

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-munity\cli-platform-android\build\mands\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-munity\cli\build\index.js:164:9)
Share Improve this question edited Jan 14, 2020 at 7:36 ramesh khadka asked Jan 14, 2020 at 6:49 ramesh khadkaramesh khadka 711 gold badge1 silver badge6 bronze badges 7
  • You might want to finish your sentence and/or question... – Nicktar Commented Jan 14, 2020 at 6:53
  • Well, what does the file mentioned ("C:\Program Files\Java\jdk-13\lib\jvm.cfg") look like? Have you edited it? – AKX Commented Jan 14, 2020 at 7:01
  • is it not runnig? – Gaurav Roy Commented Jan 14, 2020 at 7:38
  • @GauravRoy nope. it starts the emulator and stops – ramesh khadka Commented Jan 14, 2020 at 7:43
  • 1 @ZuzuJH I reinstall Java in my puter and it worked for me. – ramesh khadka Commented Jan 28, 2020 at 6:02
 |  Show 2 more ments

4 Answers 4

Reset to default 3

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.

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

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

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' mand. Specifically, it mentions that it could not load piled 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' mand again.

发布评论

评论列表(0)

  1. 暂无评论