'gradlew' is not recognized as an internal or external command error in Android Studio terminal

36,152

Solution 1

  1. gradlew command is available in your project directory. If you are trying to run this command from somewhere else it will throw error.
  2. Also gradlew command package is automatically generated by Android studio when you create a new project. It will also prompt you to generate new gradle wrapper when you open the project.
  3. you have to use ./gradlew instead of gradlew , if you are using Mac or Linux

Solution 2

It's under the Android folder, so you have to do cd Android first from your project root folder, then :

PS C:\code\my_app\android> ./gradlew signingReport

Solution 3

Try using, ./gradle clean ./gradle assembleRelease worked for me.

Solution 4

Instead of the powershell, use the Windows Command Prompt to run the command.

(This is an accidental finding. I used the visual studio code terminal to run the command gradlew assembleRelease to build the apk of a react-native project, but it outputs an error similar to above. I tried bash terminal, again failed to run. Out of curiosity, I used the Windows command prompt, then it worked. Hope this will help if other solutions are not working).

Share:
36,152
Shirish Herwade
Author by

Shirish Herwade

Android Developer, Pune India

Updated on January 30, 2022

Comments

  • Shirish Herwade
    Shirish Herwade over 2 years

    Getting error - 'gradlew' is not recognized as an internal or external command. operable program or batch file. inside Android Studio terminal.

    Can anyone please tell why it's not recognizing gradlew

  • Shirish Herwade
    Shirish Herwade about 6 years
    Thanks, the command worked when I traversed to my project's folder location from default 'sdk\platform-tools' location. But ./ didn't work, worked with only gradlew. Thanks a lot
  • Rahul Sharma
    Rahul Sharma about 6 years
    chmod +744 ./gradlew
  • charlie
    charlie about 6 years
    @ShirishHerwada I guess you are using Windows, that's why you don't require ./ . In Mac or Linux it is usually required.