Shirish Herwade
Shirish Herwade

Reputation: 11701

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

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

Upvotes: 24

Views: 131291

Answers (18)

afaqahmad922
afaqahmad922

Reputation: 1

try using these commands, command No1: (cd android) command No2: (./gradlew clean) without brackets offcourse

Upvotes: 0

Amin
Amin

Reputation: 1

I got the same error while working on a react native project in vs code when I wrote ./gradlew clean.
I just changed the forward slash ( / ) to backslash ( \ ) and it worked.

Upvotes: 0

Rizwan Ahmed
Rizwan Ahmed

Reputation: 324

gradlew didn't work on my computer, though I'm a Windows user. ./gradlew is worked successfully.

Upvotes: 0

syed hasnain
syed hasnain

Reputation: 1

If You Are Facing this error

  • Where: Script 'H:<Your Folder><Your App Name >\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 389

Do This

in Your project Folder

cd android

./gradlew

./gradlew clean

Perfectly Working

Upvotes: 0

Mohammed Zaidi
Mohammed Zaidi

Reputation: 1

In case of using Flutter for to project folder under gradle folder and run the command .\gradlew

Upvotes: 0

Bartosz Michalak
Bartosz Michalak

Reputation: 1

Try running

./gradlew signingreport

I didn't have JDK installed so, you have to do that as well if you see something like: "No JDK set and/or no java in path to be found". After installing JDK just close and open again Android Studio and do

./gradlew signingreport

once more. You should be fine by now.

Upvotes: 0

Vivek Vashistha
Vivek Vashistha

Reputation: 1042

  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

Upvotes: 54

cxkeeley
cxkeeley

Reputation: 269

in vscode do this step

  1. go to your project directory
  2. cd to android
  3. type ./gradlew in your terminal instead of gradlew
  4. voila, it works for windows user

Upvotes: 14

Krishna Kumar
Krishna Kumar

Reputation: 31

go to android directory by typing "cd android" in terminal.

then the prompt should be like this, PS C:\src\offx> cd android PS C:\src\offx\android>

(//then type) ".\gradlew signinReport" PS C:\src\offx\android> .\gradlew signinReport

Then you will get your sha keys

Upvotes: 1

Sri Ganesh Sharma
Sri Ganesh Sharma

Reputation: 11

gradlew command is only available in your project directory or gradlew file location. If you are trying to run this command from somewhere else it will throw error. so go to that particular location where gradlew file available

Upvotes: 0

Sahil bakoru
Sahil bakoru

Reputation: 662

make sure you have debug.keystore file in
PS C:\code\my_app\android> before you run ./gradlew signingReport

Upvotes: 3

Nuwan Thisara
Nuwan Thisara

Reputation: 314

Assume that you app's name is video_compresser, so when you open terminal on Windows PC(because I am trying this on Windows) it shows the prompt like this.

C:\Users\Nuwan\StudioProjects\video_compresser>

If you run gradlew from here you will get the below message

'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 the prompt should be like this,

C:\Users\Nuwan\StudioProjects\video_compresser\android>

then type gradlew followed by other commands you need and the error should be gone.

Upvotes: 5

Kicey
Kicey

Reputation: 63

If you use powershell, and the gradlew file is in the terminal current work directory, try .\gradlew instead of gradlew. Powershell don't run the command in the current work directory automatically.

Upvotes: 1

VAARI GUPTA
VAARI GUPTA

Reputation: 1

I am using windows OS and have to run a Java project in IntelliJ. I used the command prompt in admin mode then it worked for me.

Upvotes: -2

Pawara Siriwardhane
Pawara Siriwardhane

Reputation: 2055

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

Upvotes: 1

Ashish
Ashish

Reputation: 2068

ionic cordova build android --prod --release --alias=cos-android --password=abcd  --versionCode=00001 --versionName=00001 -- -- -- --packageType=bundle

cordova build android --prod --release --alias=cos-android --password=abcd  --versionCode=00001 --versionName=00001 -- -- --packageType=bundle

Upvotes: 0

Anshul Borawake
Anshul Borawake

Reputation: 149

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

Upvotes: 5

live-love
live-love

Reputation: 52366

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

Upvotes: 18

Related Questions