android - gradle的环境变量该怎么配?
PHPz
PHPz 2017-04-17 17:31:45
0
4
747

直接在Android studio 上的终端试图运行

gradle assembleDeubg

就会报找不到命令。

这是因为环境变量没有配。

但问题来了。环境变量怎么配?

在Android studio中,我一般选择

use default gradle wrapper

让工程自己去选,如果没有,就下载合适的gradle。反正科学上网速度快。

我的gradle,在

C:\Users\Administrator\.gradle\wrapper\dists

里面有近10个gradle版本,从2.2~2.11不等。

这时要配gradle的环境变量,问题就来了。

我该配哪个gradle版本的环境变量?

如果gradle又有新的版本呢?

如果配了不同版本的gradle,让它去执行类似gradle assembleDeubg的命令,不会有问题吗?

PHPz
PHPz

学习是最好的投资!

reply all(4)
洪涛

use default gradle wrapper
The correct command should begradlew assembleDebug

小葫芦

The gradle versions you see are all IDE's gradle versions. If you want to use the command line to operate gradle, those configurations are not enough. The correct approach is to download a stable version of gradle from the gradle official website, unzip it and configure the system gradle variables, just like the SDK variables, configure GRADLE_HOME so that you can operate gradle normally on the command line.

刘奇

Use gradlew assembleDebug

洪涛

1. The system environment variables are not configured, resulting in the gradle command not being found
2. Take the windows system as an example, set the system variables, and add the path for gradle execution in the path. You can use the android studio that comes with it. gradle or go to gradle official website to download a version

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template