So i am trying to start a react native android project in windows 10 based on the Getting Start React Native. I am stuck at the last step->react-native run-android
ps: Im using genymotion for my android emulator marshmallow 6.0
To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … e.g. gradlew clean allTests.
'gradlew' is not recognized as an internal or external command, operable program or batch file. so you have to go to android directory by typing cd android command from terminal. then type gradlew followed by other commands you need and the error should be gone.
The Wrapper shell script and batch file reside in the root directory of a single or multi-project Gradle build. You will need to reference the correct path to those files in case you want to execute the build from a subproject directory e.g. ../../gradlew tasks .
Got it,
Add the file location to environment variable PATH
C:\Users\user\AppData\Local\Android\Sdk\tools\templates\gradle\wrapper
Another version of the @Kai Jie findings, that works for me.
Compiling previous answers I did the following to get Android SDK and gradle working (You need gradle working anyway to compile your Android project):
Prerequisites. You have gradle installed in the folders like I found on my computer. Please, check it:
C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
Set a new system variable (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables). Do not forget to change a gradle version.
GRADLE_HOME C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
Add the following path to system paths (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables):
%GRADLE_HOME%\bin
You might want to REBOOT your computer, to make sure, that the system sees the variables.
Check if gradle works properly with the terminal commands
$ gradle -v
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With