如何设置gradle home同时导入现有的项目在Android工作室。在尝试导入时,我需要设置这个路径。


当前回答

Mac OSX / Linux

Step 1: Open terminal :)
Step 2: Open .bash_profile in vim to edit: 
        > vi ~/.bash_profile 
Step 3: Add line: 
        > export GRADLE_HOME=/usr/local/opt/gradle 
        (for me it was this location, it can be different for u)
Step 4: Add line: 
        > export PATH="$PATH:$GRADLE_HOME/bin" 
        (to export bin directory of gradle)
Step 5: Verify by reopening the terminal or new tab, and check by echoing: 
        > echo $GRADLE_HOME

其他回答

在Windows中

..\AndroidStudio2.0Beta6\android-studio\gradle\gradle-2.10

下载Gradle http://www.gradle.org/downloads 安装 将Gradle home设置为安装目录

Mac OSX / Linux

Step 1: Open terminal :)
Step 2: Open .bash_profile in vim to edit: 
        > vi ~/.bash_profile 
Step 3: Add line: 
        > export GRADLE_HOME=/usr/local/opt/gradle 
        (for me it was this location, it can be different for u)
Step 4: Add line: 
        > export PATH="$PATH:$GRADLE_HOME/bin" 
        (to export bin directory of gradle)
Step 5: Verify by reopening the terminal or new tab, and check by echoing: 
        > echo $GRADLE_HOME

在Ubuntu 14.04 $ sudo后apt-get安装gradle 我有

$ whereis gradle
gradle: /usr/bin/gradle /usr/bin/X11/gradle /usr/share/gradle /usr/share/man/man1/gradle.1.gz

Gradle的路径是/usr/share/gradle

按照上面描述的方法下载Gradle,但是要确保你下载的是1.9版本,而不是当前版本(1.11)。我只是遇到了同样的问题,下载了当前的版本,但Android Studio告诉我它不受支持。