简体   繁体   中英

'gradlew.bat' is not recognized as an internal or external command, react native

I am new to react-native / android development. I have created a react-native project. I have to run it on a real physical android device. I am following the react-native official documentation. When i do react-native run-android , i get the following error.

debug Running command "cd android && gradlew.bat app:installDebug -PreactNativeDevServerPort=8081"
'gradlew.bat' is not recognized as an internal or external command,operable program or batch file.

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: spawn gradlew.bat ENOENT

I did check adb device , my device is attached with the system but i am unable to install/run the app on real android device.

Can anyone help me? I am stuck on this issue for 2 days.

  1. Download latest gradle distribution.
  2. Set path variables
  3. From your cmd and inside android directory, run following command

    gradle wrapper

This will create necessary gradlew file inside your android directory. After this try running your app on actual device again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM