Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

Screenshot of command prompt

ps: Im using genymotion for my android emulator marshmallow 6.0

like image 489
kai jie Avatar asked Apr 02 '17 08:04

kai jie


People also ask

How do I run gradlew in terminal?

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.

Is not recognized as an internal or external command gradlew clean?

'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.

Where is the gradlew file?

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 .


2 Answers

Got it,

Add the file location to environment variable PATH

C:\Users\user\AppData\Local\Android\Sdk\tools\templates\gradle\wrapper

like image 123
kai jie Avatar answered Oct 25 '22 00:10

kai jie


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):

  1. 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\
    
  2. 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\
    
  3. Add the following path to system paths (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables):

    %GRADLE_HOME%\bin
    
  4. You might want to REBOOT your computer, to make sure, that the system sees the variables.

  5. Check if gradle works properly with the terminal commands

    $ gradle -v
    
like image 36
Roman Avatar answered Oct 25 '22 01:10

Roman