cordova Android requirements failed: "Could not find an installed version of Gradle"-ThrowExceptions

Exception or error:

I’m trying to build a Cordova Android project using the most recent tools. I followed the instructions here:

$ cordova create myApp com.myCompany.myApp myApp
$ cd myApp
$ cordova platform add android@6.2.1 --save
$ cordova requirements android --verbose

But the result is:

Running command: android list targets
Command finished with error code 0: android list,targets

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-25,android-23
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
Error: CordovaError: Some of requirements check failed
    at /usr/local/nodejs_next/lib/node_modules/cordova/src/cli.js:401:45
    at _fulfilled (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/nodejs_next/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

It doesn’t seem to be able to find Gradle (not sure where that’s supposed to be).

I’ve seen reports of issues with Cordova and Android SDK Tools 25.3, but this seems to be different, and I have 25.2.3 (see below).

I have the following (this is on CentOS 6.8):

$ cordova --version

$ node --version

$ npm --version

$ java -version
openjdk version "1.8.0_121"

$ echo $JAVA_HOME


# I installed the Android SDK from here
# under "Get just the command line tools"

$ /usr/local/android-sdk/tools/bin/sdkmanager --list
Installed packages:
  Path                        | Version | Description                    | Location                    
  -------                     | ------- | -------                        | -------                     
  build-tools;23.0.3          | 23.0.3  | Android SDK Build-Tools 23.0.3 | build-tools/23.0.3/         
  build-tools;25.0.2          | 25.0.2  | Android SDK Build-Tools 25.0.2 | build-tools/25.0.2/         
  extras;android;m2repository | 47.0.0  | Android Support Repository     | extras/android/m2repository/
  extras;google;m2repository  | 46      | Google Repository              | extras/google/m2repository/ 
  patcher;v4                  | 1       | SDK Patch Applier v4           | patcher/v4/                 
  platform-tools              | 25.0.4  | Android SDK Platform-Tools     | platform-tools/             
  platforms;android-23        | 3       | Android SDK Platform 23        | platforms/android-23/       
  platforms;android-25        | 3       | Android SDK Platform 25        | platforms/android-25/       
  tools                       | 25.2.3  | Android SDK Tools 25.2.3       | tools/                      


It doesn’t seem to be mentioned anywhere in Cordova’s or Android’s docs, but if you’re using the Android command-line tools without Android Studio, you have to manually install Gradle. Once you do, and it’s on your PATH, this error will go away.

An additional thing that was confusing me: in older versions of Android SDK tools, there was a Gradle wrapper script in tools/templates/gradle/wrapper/gradlew. This can also be used to install Gradle, but I found it easier to just install it manually. This seems to have been removed as of the latest version.

How to solve:

Solution for linux with apt-get (eg.: Ubuntu, Debian)

I have quite similar problem. I obtained error:

Error: 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 Studi

but without Exception. I solved it on Ubuntu by

sudo apt-get install gradle

I found also commands that allows install newest version of gradle in Ubuntu. It works only when first command is executed before (probably some dependecies are incorrect).

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle-ppa

If it does not work, try:

export PATH=$PATH:/opt/gradle/gradle-3.5/bin

More info:

For CentOS

Instruction of instalation gradle for CentOS is under this link


Now I installing gradle by sdkman it is something like nvm for node.

Install sdkman

curl -s "" | bash 

Install gradle

sdk install gradle 4.0.2


If you have android studio installed then you might want to try:

export PATH="$PATH:/home/<username>/android-studio/gradle/<gradle-4.0>/bin" 

This solved my problem.


For Windows:

-Download last version of Gradle (

-Create a folder and unzip files (I use C:\Program Files (x86)\gradle)

-Copy the path with the bin directory included (C:\Program Files (x86)\gradle\bin)

-Set the path C:\Program Files (x86)\gradle\bin (in my exemple) to “Path Environment Variables”

Variable name “Path” and variable value “C:\Program Files (x86)\gradle\bin” for both: User Variable table and System Variables table

You may need to reopen the “Prompt commad line”

To test, type gradle in prompt.


I m using Cordova version 7.0.1 and Cordova android version is 6.2.3. I was facing the issue while performing android build. I m using only Cordova CLI and not using android studio at all.

The quick workaround for this issue before its official fixed in Cordova is as follows:

  1. Look for check_reqs.js file under platforms\android\cordova\lib folder
  2. Edit the else part of androidStudioPath variable null check in get_gradle_wrapper function as below:

Existing code:

else {
//OK, let's try to check for Gradle!
return forgivingWhichSync('gradle');

Modified code:

else {
//OK, let's try to check for Gradle!
var sdkDir = process.env['ANDROID_HOME'];
return path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper', 'gradlew');

NOTE: This change needs to be done everytime when the android platform is removed and re-added

UPDATE: In my case, I already had gradle wrapper inside my android SDK and I dint find necessity to install gradle explicitly. Hence, I made this workaround to minimize my impact and effort



Gradle can be added on the Mac by adding the line below to ~/.bash_profile. If the file doesn’t exist, please use touch ~/.bash_profile. This hidden file can be made visible in Finder by using Command + Shift + .

export PATH=${PATH}:/Applications/Android\

Use source ~/.bash_profile to load the new path directly into your current terminal session.


Extending answer for linux (~mint) users:
1. Install Android Studio (many tools have been deprecated for command line, so this is likely required). Asuming you follow the author instrucctions, your Android Studio will be installed in /usr/local/android-studio/. At the time of writing, the gradle version in Android Studio is 3.2, look at yours with ls /usr/local/android-studio/gradle/.
2. Add your gradle command, this can be done extending the PATH, as @surendra-shrestha suggested (should be written in ~/.bashrc to preserve the PATH change), adding an alias echo 'export alias gradle=/usr/local/android-studio/gradle/gradle-3.2/bin/gradle' >> ~/.bashrc && source ~/.bashrc. Or making a symbolic link: sudo ln -sn /usr/local/android-studio/gradle/gradle-3.2/bin/gradle /usr/bin/gradle (this was my choice).
3. Run cordova requirements to check everyhing is OK, should output something like:

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-24,android-23,android-22,android-21,android-19,Google Inc.:Google APIs:19
Gradle: installed /usr/local/android-studio/gradle/gradle-3.2/bin/gradle


I followed this Qiita tutorial to solve my trouble.

Environment: Cordova 8.1.1, Android Studio 3.2, cordova-android 7.0.0

  1. Set gradle PATH into .profile file.
export PATH="/Applications/Android":$PATH
  1. Export the setting.
source ~/.profle
  1. Now build cordova project.
cordova build android

PS: If cordova-android@7.0.0 causes build error, downgrade your platform version to 6.3.0.


For me the problem was that my android version was still on 6.1.2 which is not compatible with the newest Android Studio 2.3.1.

So what I did was run

cordova platform rm android
cordova platform add android@6.2.1


To answer OP’s question:

Since you’re on Linux you’ll have to install gradle yourself, perhaps following this guide, and then put an entry in PATH to a folder that contains gradle executable.

Cordova has some code to look for gradle if you have Android Studio but only for Mac and Windows, see here:

Semi-related to OP’s question, as I’m on Windows.

After upgrading to Android Studio 2.3.1, cordova@6.5.0, cordova-android@6.2.1 (node@4.7.3), I had build issues due missing target 25 and gradle.

First issue was solved with comment from X.Zhang (i.e. change android to avdmanager), BTW it seems a commit to fix that has landed on github so cordova-android should fix that in 6.3.0 (but I didn’t test).

Second issue was as follows:

The problem turned out to be that process.env['ProgramFiles'] evaluates to 'C:\\Program Files (x86)'; whereas I have Android Studio in C:\\Program Files.

So the quick hack is to either override this value, or install Android Studio to the other place.

// platforms/android/cordova/lib/check_reqs.js

module.exports.get_gradle_wrapper = function() {
    var androidStudioPath;
    var i = 0;
    var foundStudio = false;
    var program_dir;
    if (module.exports.isDarwin()) {
        // ...
    } else if (module.exports.isWindows()) {
        // console.log(process.env['ProgramFiles'])';
        // add one of the lines below to have a quick fix...
        // process.env['ProgramFiles'] = 'C:\\Program Files (x86)';
        // process.env['ProgramFiles'] = 'C:\\Program Files';
        var androidPath = path.join(process.env['ProgramFiles'], 'Android') + '/';

I’m not sure what would be the proper fix to handle both folders in a robust way (other than iterating over both folders).

Obviously this has to be fixed in cordova-android project itself; otherwise whenever you do cordova platform rm your fixes will be gone.

I opened the ticket on Cordova JIRA:


I tried many but it didnt work finally ,

  1. I installed gradle using macos port
  2. I set GRADLE_HOME path as it told after installing gradle
  3. I executed ::

sudo chmod -R a+rwx /Library/Java/JavaVirtualMachines *

sudo chmod -R a+rwx *

sudo chmod 777 {your-gradle-path}

It immediately started working


same problem but very simple on Mac with brew:

  • brew update
  • brew install gradle



Sample problem but I found my solution with brew.
1. Make sure you have the latest Android Studio installed.
2. Confirm from SDK manager that you have the required SDKs installed.
3. (optional)you could have an AVD installed as well.
4. install Homebrew.

/usr/bin/ruby -e "$(curl -fsSL"

5. Then run brew update to make sure Homebrew is up to date.

brew update

6. Run brew doctor to make sure everything is safe

brew doctor

7. Add Homebrew’s location to your $PATH in your .bash_profile or .zshrc file.

export PATH="/usr/local/bin:$PATH"

8. If you don’t have Node already installed, add:

brew install node

9. (Optional) To test out your Node and npm install, try installing Grunt (you might be asked to run with sudo)

npm install -g grunt-cli

10. Install Gradle

brew install gradle

Run: cordova run android --device with you device connected on a Mac and you have gradle working this time.


Perhaps you installed the latest Android Studio 2.3.1, it changed command android list targets to avdmanager list targets, so there is how to fix it:

add path <android-sdk>/tools/bin to PATH, this is for MacOX.

export PATH="$PATH:/Users/<username>/Library/Android/sdk/tools/bin"

change your cordova project code <your-cordova-project>/platforms/android/cordova/lib/android_sdk.js.


module.exports.list_targets_with_android = function() {
    return superspawn.spawn('android', ['list', 'targets'])


module.exports.list_targets_with_android = function() {
    return superspawn.spawn('avdmanager', ['list', 'targets'])


Update your cordova to the latest version and the issue should be resolved.
In case the issue not resolved please set the path in the environment variable (in case of Windows). Example:
System Variable
Value name GRADLE_HOME
Value D:\Android\Android Studio\gradle\gradle-4.3.1 (please replace with your path)


Run in terminal:

$ sudo apt-get update
$ sudo apt-get install gradle

This works for me in Ubuntu 18.04


“Android target: not installed”

Please install Android target / API level: “android-25”.

You need to create an Android Virtual Device (API level: “android-25” or latest) or need to add android real device.

Also you can import the project in Android Studio and run.

You can check here:

Leave a Reply

Your email address will not be published. Required fields are marked *