How to set gradle home while importing existing project in Android studio

384,007

Solution 1

The gradle plugin (which contains a bundled version of gradle) should be already installed in where/you/installed/android-studio/plugins/gradle so you shouldn't need to manually download it. Depending on the version of Android Studio, that last directory may be where/you/installed/android-studio/gradle/gradle-x.y.z (x.y.z is the version, so check your filesystem for the exact path).

If you intend on doing gradle development outside Android Studio or want a different version, you can download it separately and point it at that path, but if you only want to get Android Studio working with the bundled version, this path should do it.

Solution 2

For Mac OS, you can use the following -

  1. /usr/local/opt/gradle/libexec/ or more generically - path/to/gradle/libexec/ - this is recommended. (the first path is what's achieved after installing gradle via Homebrew)
  2. /path/to/android/studio/plugins/gradle - I don't recommend this because this version of Gradle might be out of date, and Android Studio itself might say it's incompatible.

Solution 3

You should be able to find it in C:\Program Files\Android\Android Studio\Gradle\Gradle 2.2.1. This is running Windows 7 64-Bit. Android Studio 1.0.2.

Solution 4

OSX (Less han two minutes)

  1. Open terminal
  2. Check if Gradle installed gradle --version, if so, goto step 4
  3. If not brew install gradle and Goto step 2
  4. Copy /usr/local/opt/gradle/libexec/
  5. Paste it in Import Project Window in Android Studio > Gradle Home
  6. Important, Celebrate!

Solution 5

  1. Download Gradle http://www.gradle.org/downloads
  2. Install
  3. Set Gradle home to the install directory
Share:
384,007

Related videos on Youtube

Dennis MP
Author by

Dennis MP

I love coding. Blog : http://1belong2jesus.wordpress.com/

Updated on July 08, 2022

Comments

  • Dennis MP
    Dennis MP almost 2 years

    How to set gradle home while importing existing project in Android studio. While trying to import I need to set up this path. enter image description here

  • vharron
    vharron about 10 years
    The path plugins/gradle is to the gradle plugin, not gradle.
  • vharron
    vharron about 10 years
    The path plugins/gradle is to the gradle plugin, not gradle.
  • byteit101
    byteit101 about 10 years
    Is there any differences between them for the purposes of importing projects in Android Studio?
  • vharron
    vharron about 10 years
    Gradle plugin 0.9.0 and 0.10.0 both support Android Studio tools.android.com/tech-docs/new-build-system
  • AlexChaffee
    AlexChaffee almost 10 years
    I think it'd be better to use a real gradle dir. It's wherever you installed it plus "libexec" for me, e.g. /usr/local/opt/gradle/ (from Homebrew on Mac)
  • Tyrel
    Tyrel over 9 years
    I just tried this with Android Studio 0.8.0 and it complained about using the plugin directory. I noticed though that gradle seems to be entirely located within the lib subdir, so I then instead pointed Android Studio to where/you/installed/android-studio/plugins/gradle/lib and it worked.
  • Calin
    Calin over 9 years
    A better option will be to use /usr/lib/gradle/default no to depend on specific version
  • Tim Boland
    Tim Boland over 9 years
    on a mac, this didnt work for me...wouldnt allow me to select the build.gradle file for my project
  • hotzen
    hotzen over 9 years
    Do not point it to the gradle-plugin but to the gradle-library which is in .../android-studio/plugins/gradle/**lib**
  • lagos
    lagos over 9 years
    If you point to the gradle-lib as last person commented you will get an error from Android Studio that is not the right folder.
  • OKGimmeMoney
    OKGimmeMoney over 9 years
    the directory in this answer was different for me. I used /install/path/to/android-studio/gradle/gradle-2.2.1
  • akauppi
    akauppi about 9 years
    @AlexChaffee Could you share the whole path entry you have there. I'm also on OS X + Homebrew. What do you mean by 'plus "libexec"', precisely? IntelliJ IDEA 14.0.3, gradle 2.3
  • akauppi
    akauppi about 9 years
    Thanks, /usr/local/Cellar/gradle/2.3/libexec/ worked for me. + you might add that your reply has to do with OS X + Homebrew.
  • akauppi
    akauppi about 9 years
    OS X + Homebrew: /usr/local/Cellar/gradle/2.3/libexec/
  • Morteza Soleimani
    Morteza Soleimani about 9 years
    Thanks , It helped me :)
  • mnzl
    mnzl almost 9 years
    Line 68 in the /usr/bin/grade file
  • Friedrich Große
    Friedrich Große over 8 years
    Also works on fedora 22 if gradle has been installed using dnf
  • htafoya
    htafoya over 7 years
    how to know the install directory?
  • stackdave
    stackdave almost 7 years
    say me: "graddle libexe is not supported, would you like to use graddle wrapper to update automatically ?" i clicked "yes" and alles was ok, it was strange because ; "brew info gradle " give this folder "/usr/local/Cellar/gradle/3.1" but Android Studio does not recognise gradle there
  • David
    David over 6 years
    Excellent. The key info for me here was that you need to point it to [...]/libexec
  • jim
    jim over 6 years
    Mine was here: C:\Program Files\Android\Android Studio\gradle\gradle-3.2
  • Kingsley Ijike
    Kingsley Ijike over 6 years
    Thanks! Just what I needed
  • The incredible Jan
    The incredible Jan almost 5 years
    @htafoya how to know which operating system and installation type you use? "Installing manually" should be the easiest on all systems. The "install" directory is the directory where you extract to.
  • user3118604
    user3118604 almost 5 years
    @htafoya you can follow the official per-OS Gradle instructions found here gradle.org/install/#manually
  • Carnal
    Carnal over 4 years
    That's how you do it!