美文网首页移动端开发Android知识android实用技术
MAC上这样安装GRADLE挺清爽的——向SDKMAN致敬

MAC上这样安装GRADLE挺清爽的——向SDKMAN致敬

作者: 曹建峰 | 来源:发表于2016-09-07 13:32 被阅读10198次
随意一搜看到这个:如何在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工具的使用...

相关文章

网友评论

  • AbsurdOS:sdk install gradle
    ==== INTERNET NOT REACHABLE! ===================================================

    Some functionality is disabled or only partially available.
    If this persists, please enable the offline mode:

    $ sdk offline

    ================================================================================
  • QinChBeSt:-bash: sdk: command not found
    6334f0510f7a:source "$HOME/.sdkman/bin/sdkman-init.sh" 原来还需要执行脚本
    6334f0510f7a:同上 请问解决了么
  • 海綿已不是寶寶:我照你这样安装成功了,但是echo $GRADLE_HOME的时候却是空的,echo $PATH正常。这是为什么呢?
    曹建峰:把你执行的命令的输入输出贴给我看看,这样:
    ···
    $ echo $GRADLE_HOME
    /Users/Mac-OS/.sdkman/candidates/gradle/2.10
    ···
  • 07f682297f36:感觉还是官方的最好
  • 萌萌的白天:我就说一点 那个第一个命令之前那$ 是不需要的
    萌萌的白天:@曹建峰 主要是小白用户不知道
    曹建峰:@萌萌的白天 谢谢,那个是命令行的提示符,如果是root用户的话是#
  • dzgdp888:mac上最简单的方式,没有之一:brew install gradle
    Boy_iOS:安装总是不成功,怎么办
    Boy_iOS:Looking for a previous installation of SDKMAN...
    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!!!
    Boy_iOS:然后呢!

本文标题:MAC上这样安装GRADLE挺清爽的——向SDKMAN致敬

本文链接:https://www.haomeiwen.com/subject/buujettx.html