Closed cocowalla closed 7 years ago
This is a known issue with the Cordova CLI (has nothing to do with VS TACO). I encountered this last week setting up a new Cordova development environment. If you read the error message its telling you it can't find Gradle. Install Gradle and the problem will go away.
For some reason the CLI can't seem to find the one installed with Android Studio. That's what I experienced anyway.
@johnwargo I did read the error message, I just figured that gradle must be installed already. Wondered if there was some way to get it to recognise the existing gradle.
Anyway, I just setup a couple of tasks to install gradle, and it does now work.
To help others, I used a Powershell script to download gradle:
Param([Parameter(Mandatory=$True,Position=1)]
[string]$BaseDir)
$Url = "https://services.gradle.org/distributions/gradle-4.1-bin.zip"
$DownloadDir = [IO.Path]::Combine($BaseDir, "temp")
$DownloadPath = [IO.Path]::Combine($BaseDir, "temp\gradle.zip")
$OutputPath = [IO.Path]::Combine($BaseDir, "gradle")
Write-Host "Paths:"
Write-Host "`tBase path : ${BaseDir}"
Write-Host "`tDownload path : ${DownloadPath}"
Write-Host "`tOutput path : ${OutputPath}"
Write-Host
# Create download directory
New-Item -ItemType Directory -Force -Path ${DownloadDir} | Out-Null
# Download gradle ZIP file
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile($Url, $DownloadPath)
# Extract gradle from the ZIP file
Expand-Archive $DownloadPath -DestinationPath $OutputPath
Note for this one I set the Arguments
in the task to $(Agent.BuildDirectory)
I also used a one-line batch file to prefix the PATH
environment variable with the location of our downloaded gradle (I got an access error when trying to change it from Powershell; seems you need to use a Run script
task with Modify Environment
enabled):
SET PATH=%1;%PATH%
Note for this one I set the Arguments
in the task to $(Agent.BuildDirectory)\gradle\gradle-4.1\bin
Actually, I take it back - the build task succeeds, but the assets\www
folder in the generated apk doesn't appear to contain any of my code, just default Cordova stuff :(
So, shall we reopen this issue please?
Any news about it ?
Apologies if this appears a little boiler-plate, but Visual Studio 2017 (and by extension MSBuild and vsts-cordova-tasks) only support Cordova v6.3.1. Are there any failures using this version?
I used the Mac Agent for VSTS so it's working now
I'm trying to setup a build definition to build an Android app. The npm install task succeeds, as does the Ionic Command task (which I use to do
ordova platform add android
.I have the Cordova Build task configured to use Cordova 7.0.1 (which works fine for our local builds), but the task is failing with:
I've tried this with both the Hosted and Hosted VS2017 agents, with the same result.