microsoft / vsts-cordova-tasks

Streamline CI setup for your Apache Cordova, PhoneGap, Ionic, or Cordova CLI compatible app using a set of useful pre-defined build steps for VS Team Services or TFS
http://go.microsoft.com/fwlink/?LinkID=691188
Other
25 stars 27 forks source link

VSTS build error using Cordova version 6.5.0 #71

Closed tcihak-fqa closed 7 years ago

tcihak-fqa commented 7 years ago

Using the Cordova Build task in VSTS and setting the Cordova Version to 6.5.0. The Cordova build now requires gradle to be installed.

Here's the error: { CordovaError: 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 at Object.module.exports.check_gradle (d:\a\1\s\platforms\android\cordova\lib\check_reqs.js:146:18) at GradleBuilder.prepEnv (d:\a\1\s\platforms\android\cordova\lib\builders\GradleBuilder.js:176:23) at Api.module.exports.run (d:\a\1\s\platforms\android\cordova\lib\build.js:152:20) at d:\a\1\s\platforms\android\cordova\Api.js:348:43 at _fulfilled (d:\a\1\s\platforms\android\cordova\node_modules\q\q.js:854:54) at self.promiseDispatch.done (d:\a\1\s\platforms\android\cordova\node_modules\q\q.js:883:30) at Promise.promise.promiseDispatch (d:\a\1\s\platforms\android\cordova\node_modules\q\q.js:816:13) at d:\a\1\s\platforms\android\cordova\node_modules\q\q.js:624:44 at runSingle (d:\a\1\s\platforms\android\cordova\node_modules\q\q.js:137:13) at flush (d:\a\1\s\platforms\android\cordova\node_modules\q\q.js:125:13) name: 'CordovaError', message: 'Could not find an installed version of Gradle either in Android Studio,\nor on your system to install the gradle wrapper. Please include gradle \nin your path, or install Android Studio',

dpetrishin commented 7 years ago

@tcihak-fqa Hi, what kind of OS do you use?

tcihak-fqa commented 7 years ago

This is on the VSTS Hosted agent, so it's Windows Server 2012 R2.

dpetrishin commented 7 years ago

@tcihak-fqa Ok, thanks for information.

That bug appears because of update of android sdk tools. So cordova refers on folder which is not exists in new android sdk tools versions now. While cordova is fixing that bug I can offer you temporary solution.

Early that bug was fixed by installing of Android Studio in Windows. But it's not helped in MacOS. So you could try to install Android Studio and see what happens or do steps, described below.

Please, follow my instructions.

  1. Download older version of android sdk tools.
  2. Go to :\Users\%User%\AppData\Local\Android\sdk
  3. Make a backup of tools folder.
  4. Replace tools folder with downloaded one.

Hope, this will help.

tcihak-fqa commented 7 years ago

Here's what I am doing in my VSO build definition:

  1. Downloading Gradle 3.3 bin using the Powershell task
  2. Extracting Gradle to the workspace
  3. Creating a batch script to pre-pend the gradle path (.\gradle-3.3\bin) to the "path" environment variable (append didn't work because the path is too long?)
  4. Running the batch script using the Batch Script task (with Modify Environment checked)
  5. Building my using Cordova
cocowalla commented 7 years ago

@tcihak-fqa do those steps work for you? If so, would you be able to create a gist with your scripts?