Mac OS环境变量配置(Android Studio之Gradle)

时间:2021-03-16 04:41:01

以gradle环境变量配置为例:

Android Studio 自带的gradle路径为:

/Applications/Android\ Studio.app/Contents/gradle/gradle-2.8/bin

1.打开终端

2.输入:vim ~/.bash_profile

3.进入编辑模式

4.在文本末尾添加如下信息

export GRADLE_HOME=/Applications/Android\ Studio.app/Contents/gradle/gradle-2.8

export PATH=${PATH}:${GRADLE_HOME}/bin

5.退出编辑模式,输入:wq退出

6.输入:gradle -v显示如下信息,表明环境变量配置成功

------------------------------------------------------------

Gradle 2.10

------------------------------------------------------------

Build time:   2015-12-21 21:15:04 UTC

Build number: none

Revision:     276bdcded730f53aa8c11b479986aafa58e124a6

Groovy:       2.4.4

Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013

JVM:          1.8.0_65 (Oracle Corporation 25.65-b01)

OS:           Mac OS X 10.11.1 x86_64