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

18

20

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

Nonparticipation answered 14/3, 2018 at 7:11 Comment(2)
In my case I was trying gradlew clean && gradlew assembleRelease instead of gradlew.BAT clean && gradlew.BAT assembleReleaseWessel
Try using, ./gradle clean && ./gradle assembleRelease worked for me.Unconscious
K
50
  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
Kandrakandy answered 14/3, 2018 at 7:17 Comment(3)
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 lotNonparticipation
chmod +744 ./gradlewGrandiloquence
@ShirishHerwada I guess you are using Windows, that's why you don't require ./ . In Mac or Linux it is usually required.Kandrakandy
W
17

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
Washcloth answered 22/12, 2020 at 20:41 Comment(0)
D
12

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
Dekeles answered 10/7, 2022 at 8:53 Comment(0)
U
5

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

Unconscious answered 11/1, 2021 at 4:46 Comment(1)
./gradlew clean worked for me.Conoid
C
5

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.

Circadian answered 12/4, 2022 at 3:47 Comment(2)
cd : Cannot find path 'D:\your-project\project-name-Android\android' because it does not exist.Cockatrice
@BilalBangash is that your actual project path?Circadian
B
3

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

Blab answered 22/6, 2022 at 9:54 Comment(0)
L
1

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

Lenwood answered 29/1, 2022 at 14:13 Comment(0)
R
1

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.

Romaineromains answered 18/4, 2022 at 9:31 Comment(0)
C
1

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

Challenging answered 15/5, 2022 at 4:27 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Bordeaux
B
0
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
Batson answered 8/8, 2021 at 7:34 Comment(0)
B
0

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

Brey answered 6/7, 2022 at 10:18 Comment(0)
M
0

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.

Metts answered 24/5, 2023 at 20:48 Comment(0)
A
0

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

Archaeo answered 5/10, 2023 at 4:54 Comment(0)
B
0

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

Betty answered 1/12, 2023 at 13:36 Comment(0)
A
0

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

Ambassadoratlarge answered 26/12, 2023 at 4:38 Comment(0)
I
0

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.

Inboard answered 15/4, 2024 at 19:47 Comment(0)
D
0

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

Desma answered 28/6, 2024 at 10:49 Comment(0)
S
-2

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.

Stakeout answered 4/4, 2022 at 12:6 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewCage

© 2022 - 2025 — McMap. All rights reserved.