I'm on Windows 10 and I have Android Studio installed and a version of the SDK installed. If I wish to use gradle on my command line(I'm running cordova requirement), how do I find out the path of gradle? If gradle is installed together with Android Studio that is.
Android Studio installs Gradle in a folder that looks like:
C:\Users\<username>\.gradle\wrapper\dists\gradle-7.0.2-bin\857tjihv64xamwrf0h14cai3r\gradle-7.0.2\bin
Please note that "7.0.2" is the gradle version, and this number may be different for you.
Find this path in you computer and add it to Windows "Path" environment variable. On Start Menu, type "environment variable", select "Path", click on "Edit" and add the gradle path to the list.
Restart "Command Prompt" (or PowerShell) before running cordova requirements again.
I run cordova requirements on an Android app created with cordova and are getting this error:
Gradle: not installed
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
First I would like to say that yes, I can install it manually, but why if it should be included?
So what is the issue here? Is it a lie that it should be sufficient to install Android Studio as the error message says? Do I need to install it manually also? Or do I simply need to set a path?
Gradle is probably included in Android Studio. At least, some of its tooling APIs must be included to provide Gradle interop.
However, Android Studion has nothing to deal with the command line commands you're running in console, like cordova requirements. You should probably install it and make available globally. SDKMAN! is a good tool to manage tools in Java world.
I'm using Ubuntu 18.04
Android Studio Version 3.6.3
I think I have two installed Gradle locations If I'm not wrong
One of them installed using sdkman, when I use terminal to locate the Gradle
which gradle
Also, I've found (I don't remember if I installed Gradle in another way instead of sdkman) in my home directory, this is the one which Android Studio is using (I think) and make issues when opening a project
I think I need to use sdkman as it's easier to update the Gradle version etc.
So, my question is should I remove the gradle from: "/home/khaledomara/.gradle". If so, what is the best method to do that and what path should I put in the settings of Android studio?
Should it be "/home/khaledomara/.sdkman/candidates/gradle/current/bin/gradle"?
You only have one Gradle installed - the ~/.gradle directory is where a running Gradle process stores data and it can be safely deleted (assuming you don't have a gradle.properties or similar with any settings you want to save - but there is no need to delete it).
It is not a bad idea to do a gradle init in your Android Studio project - this will give your project its own Gradle that you can upgrade at your leisure without having to rely on the globally installed Gradle.
How to set gradle home while importing existing project in Android studio. While trying to import I need to set up this path.
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.
For Mac OS, you can use the following -
/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)
/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.
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.
OSX (Less han two minutes)
Open terminal
Check if Gradle installed gradle --version, if so, goto step 4
If not brew install gradle and Goto step 2
Copy /usr/local/opt/gradle/libexec/
Paste it in Import Project Window in Android Studio > Gradle Home
Important, Celebrate!
Download Gradle http://www.gradle.org/downloads
Install
Set Gradle home to the install directory
On Linux run: whereis gradle.
For me it was /usr/lib/gradle/1.10.
I ran into same problem. I selected location C:\Program Files (x86)\Android\android-studio\plugins\gradle as Gradle Home
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
For Mac,
/Applications/Android Studio.app/Contents/gradle/gradle-3.2
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.
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/
For migrating from eclipse to android studio
(Do not need to specify the Gradle home.)
Locate the project you exported from Eclipse, expand it, select the build.gradle file and click OK.
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/
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.
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
On Linux Mint 17 it was
/usr/share/gradle
for me
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.
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
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
I had to use this
"C:\Program Files\Android\Android Studio\gradle\gradle-4.1"
Change the version if you have a different one.
I am using Lubuntu, I ended up finding it in :
/usr/share/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.
In Windows
..\AndroidStudio2.0Beta6\android-studio\gradle\gradle-2.10
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 windows machine, go to the directory C:\Program Files\Android\Android Studio\gradle\ and click the gradle folder and apply it on
This worked.
C:\Program Files\Android\Android Studio\gradle\gradle-3.2
If you're using MacPorts gradle's home is:
/opt/local/share/java/gradle
For Ubuntu default version is /usr/lib/gradle/default.
In case of update, you don't need to reassign link in idea/studio.
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
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.
On Windows it was
C:/Android Studio/jre