[android-studio] How to set gradle home while importing existing project in Android studio

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

The answer is


Download Gradle as described above, but make sure you download version 1.9 and not the current release (1.11). I just had the same problem and downloaded the current release only to have Android Studio tell me it wasn't supported.


I had to use this

"C:\Program Files\Android\Android Studio\gradle\gradle-4.1"

Change the version if you have a different one.


If you are on windows machine, go to the directory C:\Program Files\Android\Android Studio\gradle\ and click the gradle folder and apply it on


I tried byteit101's solution but whether I chose android-studio-path/plugins/gradle or android-studio-path/plugins/gradle/lib the IDE said it isn't correct.

Then I changed the gradle home to android-studio-path/gradle/gradle-x.x.x and it works.


I used umake to install android studio. For me the path was

/home/user/.local/share/umake/android/android-studio/gradle/gradle-2.14.1

In Windows

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

For OSX, if going to Finder, navigate to this category: /usr/local/opt/ if you do not see gradle folder, install your grandle version manually:

https://services.gradle.org/distributions/gradle-5.4.1-all.zip

https://services.gradle.org/distributions/gradle-4.4.1-all.zip

If you are looking for specific Gradle version, simply change the version number from the zip links above, unzip and add that in the Gradle folder /usr/local/opt/gradle


This worked. C:\Program Files\Android\Android Studio\gradle\gradle-3.2


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.


For Ubuntu default version is /usr/lib/gradle/default. In case of update, you don't need to reassign link in idea/studio.


In Ubuntu 14.04 after $ sudo apt-get install gradle I've got

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

The path to Gradle was /usr/share/gradle


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

For Mac,

/Applications/Android Studio.app/Contents/gradle/gradle-3.2

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!

I've stumble across this question, trying to build an Ionic + Cordova app using Gradle from Android Studio installation, rather that installing Gradle separately.

On Centos, the Gradle binary was here: /home/YOURUSERNAME/.gradle/wrapper/dists/gradle-VERSION-all/CUSTOM_HASH/gradle-VERSION/bin

So, I've added export PATH=/home/maxim/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1/bin:$PATH to my ~/.bashrc and ionic cordova run android command worked just fine.


If you are on a Windows machine, gradle home is located inside the installation folder of your Android Studio, usually at:

C:\Program Files\Android\Android Studio\gradle\gradle-5.1.1

Change the version if you have a different one.


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.

For migrating from eclipse to android studio

(Do not need to specify the Gradle home.)

  1. Locate the project you exported from Eclipse, expand it, select the build.gradle file and click OK.
  2. In the following dialog, leave Use gradle wrapper selected and click OK.

Try this for windows users

http://blog.blundell-apps.com/setting-up-android-studio-gradle-windows-7/


This is my solution on AndroidStudio/Idea for Mac

$ env | grep GRADLE
GRADLE_HOME=/usr/local/Cellar/gradle/2.6
GRADLE_USER_HOME=/Users/leon/.gradle

On Linux run: whereis gradle.

For me it was /usr/lib/gradle/1.10.


On Arch Linux I could not find it, so I added:

echo $APP_HOME

to /usr/bin/grade (found over which gradle)

The Install dir for me was /usr/share/java/gradle/


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

I am using Lubuntu, I ended up finding it in :

/usr/share/gradle


On Linux Mint 17 it was

/usr/share/gradle

for me


I ran into same problem. I selected location C:\Program Files (x86)\Android\android-studio\plugins\gradle as Gradle Home


If you're using MacPorts gradle's home is:

/opt/local/share/java/gradle

Don't need to download or specify anything...

Just go to the install Android Studio plugins Path and search for any file like gradle-wrapper-x.xx.jar (x.xx = version number). Copy it to a subfolder of your project root folder named : gradle.

Example : - file found gradle-wrapper-1.12.jar in plugins folder of Android Studio Install's path - my project was on D:\android_repo\myProject - created a folder into D:\android_repo\myProject\gradle - copy gradle-wrapper-1.12.jar to this folder D:\android_repo\myProject\gradle - import again my project and no more question about gradle.


If you are on a Windows machine, go to the directory:

C:\Program Files\Android\Android Studio\gradle\

Click the gradle-4.4 folder from Android Studio\File\Settings, and then click the Apply button.

enter image description here


Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to intellij-idea

IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error: Java: invalid target release: 11 - IntelliJ IDEA IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 ERROR Source option 1.5 is no longer supported. Use 1.6 or later Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How to configure "Shorten command line" method for whole project in IntelliJ intellij idea - Error: java: invalid source release 1.9 Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

Examples related to android-gradle-plugin

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Android Material and appcompat Manifest merger failed Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries Invoke-customs are only supported starting with android 0 --min-api 26 error: resource android:attr/fontVariationSettings not found Exception : AAPT2 error: check logs for details Could not resolve com.android.support:appcompat-v7:26.1.0 in Android Studio new project Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)