随意一搜看到这个:如何在mac上安装gradle
如果你还这样安装gradle你就out了
gradle官网最新推荐SDKMan安装Gradle:
第一步:打开一个终端安装SDKMAN!
curl -s https://get.sdkman.io | bash
source "/Users/[your username]/.sdkman/bin/sdkman-init.sh"
第二步:新打开一个终端安装你想要的gradle版本
sdk install gradle 3.3
然后呢,没有然后了
关于SDKMAN
如果你以前手工配置过GRADLE_HOME环境变量最好先删掉。
因为SDKMAN会为我们做这些工作。
如果你用sdkman安装完可以这样看一下环境变量:
$ echo $GRADLE_HOME
/Users/Mac-OS/.sdkman/candidates/gradle/2.10
$ echo $PATH
/Users/Mac-OS/.sdkman/candidates/gradle/2.10/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/Mac-OS/Library/Android/sdk/tools:/Users/Mac-OS/Library/Android/sdk/tools:/Users/Mac-OS/Library/Android/sdk/platform-tools
sdkman为我们设好了,好贴心啊。
建议你探索一下sdkman,如果你英文好就敲一下 :
sdk help
或者看看官网使用说明
英文不好也可以看中文的文章sdkman工具的使用...
网友评论
==== INTERNET NOT REACHABLE! ===================================================
Some functionality is disabled or only partially available.
If this persists, please enable the offline mode:
$ sdk offline
================================================================================
···
$ echo $GRADLE_HOME
/Users/Mac-OS/.sdkman/candidates/gradle/2.10
···
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:01:00 --:--:-- 0
curl: (35) Server aborted the SSL handshake
Extract script archive...
[/Users/zhaoguoteng/.sdkman/tmp/res-5.5.2+183.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /Users/zhaoguoteng/.sdkman/tmp/res-5.5.2+183.zip or
/Users/zhaoguoteng/.sdkman/tmp/res-5.5.2+183.zip.zip, and cannot find /Users/zhaoguoteng/.sdkman/tmp/res-5.5.2+183.zip.ZIP, period.
Install scripts...
mv: rename /Users/zhaoguoteng/.sdkman/tmp/stage/sdkman-init.sh to /Users/zhaoguoteng/.sdkman/bin/sdkman-init.sh: No such file or directory
mv: rename /Users/zhaoguoteng/.sdkman/tmp/stage/sdkman-* to /Users/zhaoguoteng/.sdkman/src/sdkman-*: No such file or directory
Set version to 5.5.2+183 ...
Attempt update of bash profiles...
Attempt update of zsh profiles...
-e
All done!
Please open a new terminal, or run the following in the existing one:
source "/Users/zhaoguoteng/.sdkman/bin/sdkman-init.sh"
Then issue the following command:
sdk help
Enjoy!!!