[英]'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.
出现错误 - 'gradlew' is not recognized as an internal or external command. operable program or batch file.
'gradlew' is not recognized as an internal or external command. operable program or batch file.
inside Android Studio terminal.在 Android Studio 终端内。
Can anyone please tell why it's not recognizing gradlew谁能告诉为什么它不能识别gradlew
它位于 Android 文件夹下,因此您必须先从项目根文件夹中执行 cd Android,然后:
PS C:\code\my_app\android> ./gradlew signingReport
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.假设您的应用程序名称是video_compresser ,因此当您在 Windows PC 上打开终端时(因为我正在 Windows 上尝试此操作),它会显示如下提示。
C:\Users\Nuwan\StudioProjects\video_compresser>
If you run gradlew
from here you will get the below message如果您从此处运行gradlew
,您将收到以下消息
'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.所以你必须通过从终端输入cd android
命令进入android目录。
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.然后键入gradlew
,然后键入您需要的其他命令,错误应该消失了。
尝试使用./gradle clean
./gradle assembleRelease
为我工作。
Instead of the powershell, use the Windows Command Prompt to run the command.使用 Windows 命令提示符代替 powershell 来运行命令。
(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). (这是一个意外发现。我使用Visual Studio代码终端运行命令gradlew assembleRelease
来构建一个react-native项目的apk,但它输出类似于上面的错误。我尝试了bash终端,再次无法运行。出于好奇,我使用了 Windows 命令提示符,然后它起作用了。如果其他解决方案不起作用,希望这会有所帮助)。
If you use powershell, and the gradlew file is in the terminal current work directory, try .\gradlew instead of gradlew.如果您使用 powershell,并且 gradlew 文件位于终端当前工作目录中,请尝试使用 .\gradlew 而不是 gradlew。 Powershell don't run the command in the current work directory automatically. Powershell 不会自动运行当前工作目录中的命令。
make sure you have debug.keystore file in确保你有 debug.keystore 文件PS C:\code\my_app\android>
before you run ./gradlew signingReport
PS C:\code\my_app\android>
在你运行之前./gradlew signingReport
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
go to android directory by typing cd android command from terminal.通过从终端键入 cd android 命令转到 android 目录。
then the prompt should be like this, PS C:\src\offx> cd android PS C:\src\offx\android>那么提示应该是这样的, PS C:\src\offx> cd android PS C:\src\offx\android>
(//then type) ".\gradlew signinReport" PS C:\src\offx\android> .\gradlew signinReport (//然后输入) ".\gradlew signinReport" PS C:\src\offx\android> .\gradlew signinReport
Then you will get your sha keys然后你会得到你的 sha 密钥
gradlew command is only available in your project directory or gradlew file location. gradlew 命令仅在您的项目目录或 gradlew 文件位置可用。 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所以去那个 gradlew 文件可用的特定位置
in vscode do this step在 vscode 中做这一步
I am using windows OS and have to run a Java project in IntelliJ.我正在使用 Windows 操作系统,并且必须在 IntelliJ 中运行 Java 项目。 I used the command prompt in admin mode then it worked for me.我在管理员模式下使用了命令提示符,然后它对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.