title: cordova Android requirements failed: "Could not find an installed version of Gradle"
body: <p>I'm trying to build a Cordova Android project using the most recent tools. I followed the instructions <a href="https://cordova.apache.org/docs/en/latest/guide/cli/" rel="noreferrer">here</a>:</p>
  
  <pre><code>$ cordova create myApp com.myCompany.myApp myApp
  $ cd myApp
  $ cordova platform add android@6.2.1 --save
  $ cordova requirements android --verbose
  </code></pre>
  
  <p>But the result is:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>It doesn't seem to be able to find Gradle (not sure where that's supposed to be).</p>
  
  <p>I've seen <a href="https://issues.apache.org/jira/browse/CB-12524" rel="noreferrer">reports</a> of issues with Cordova and Android SDK Tools 25.3, but this seems to be different, and I have 25.2.3 (see below).</p>
  
  <p>I have the following (this is on CentOS 6.8):</p>
  
  <pre><code>$ cordova --version
  6.5.0
  
  $ node --version
  v6.10.2
  
  $ npm --version
  3.10.10
  
  $ java -version
  openjdk version "1.8.0_121"
  
  $ echo $JAVA_HOME
  /usr/lib/jvm/java-1.8.0
  
  $ echo $ANDROID_HOME
  /usr/local/android-sdk
  
  # I installed the Android SDK from here
  # https://developer.android.com/studio/index.html#downloads
  # 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/                      
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>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.</p>
  
  <p>An additional thing that was confusing me: in older versions of Android SDK tools, there was a Gradle wrapper script in <code>tools/templates/gradle/wrapper/gradlew</code>. 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.</p>