Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9389

Android. Fix Gradle requirements test

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cordova-android
    • Labels:
      None

      Description

      Cordova Android on Windows10:

      After switching to the latest Cordova from master I noticed that Android build hangs after the following line
      JAVA_HOME=c:\Program Files (x86)\Java\jdk1.8.0_11

      After adding additional logging I found out that it hangs internally on the following check:

      tryCommand: "c:\tools\android-sdk\sdk\tools\templates\gradle\wrapper\gradlew" -v
      

      Looks like this command tries to download gradle wrapper (PS. version also looks old)

      λ  "c:\tools\android-sdk\sdk\tools\templates\gradle\wrapper\gradlew" -v
      Downloading http://services.gradle.org/distributions/gradle-1.12-all.zip
      .....................................................................................................................
      

      even if I have gradle tools installed and correctly set GRADLE_HOME environment variable:

      C:\Users\Sergei
      λ echo %gradle_home%
      C:\tools\gradle-2.3\
      C:\Users\Sergei
      λ gradle -v
      
      ------------------------------------------------------------
      Gradle 2.3
      ------------------------------------------------------------
      
      Build time:   2015-02-16 05:09:33 UTC
      Build number: none
      Revision:     586be72bf6e3df1ee7676d1f2a3afd9157341274
      
      Groovy:       2.3.9
      Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
      JVM:          1.8.0_11 (Oracle Corporation 25.11-b03)
      OS:           Windows 8.1 6.3 x86
      

      Here is corresponding logic in check_regs.js:

      // Returns a promise. Called only by build and clean commands.
      module.exports.check_gradle = function() {
          var sdkDir = process.env['ANDROID_HOME'];
          var message = 'Could not find gradle wrapper within Android SDK. ';
          if (!sdkDir) return Q.reject(message + 'Might need to install Android SDK or set up \'ADROID_HOME\' env variable.');
          var wrapper = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper', 'gradlew');
          return tryCommand('"' + wrapper + '" -v', message + 'Might need to update your Android SDK.\n' +
                  'Looked here: ' + path.dirname(wrapper))
          .then(function (output) {
              // Parse Gradle version from command output
              return/^gradle ((?:\d+\.)+(?:\d+))/gim.exec(output)[1];
          });
      };
      
      

        Attachments

          Activity

            People

            • Assignee:
              vladimir.kotikov Vladimir Kotikov
              Reporter:
              sgrebnov Sergey Grebnov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: