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

Cordova task is failing to complete the build #82

Open dmittal02 opened 6 years ago

dmittal02 commented 6 years ago

we are facing issue with the cordova task. In the task with command build android and using hosted 2017 agent, task does not complete and after some time build get cancelled. Any idea if it is known issue.

dmittal02 commented 6 years ago

Anyone on this.

drewgillies commented 6 years ago

Hi--it's possibly a known issue, although there is very little detail here. One workaround you could try is to include /p:instanceid=[instanceid] in the Arguments field for the Cordova build step, where [instanceid] is the code taken from the folder in %ProgramData%\Microsoft\VisualStudio\MDA which is relevant to your installation (if there is only one VS 2017 installed you should see only one). Hope this helps.

scott-hahn commented 6 years ago

@dmittal02 You reported this issue a day after Cordova was upgraded to 8.0.0. You might try configuring your build task to use an older version ("7.1.0" for example), if possible. I've also had trouble building a simple (from the CLI - cordova create hello com.example.hello HelloWorld) using this same task with Cordova 8. I'm using the VSTS Hosted macOS build agents and getting the error:

TypeError: Cannot read property 'fail' of undefined at /Users/vsts/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/src/plugman/fetch.js:168:17 at _fulfilled (/Users/vsts/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/Users/vsts/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:816:30) at Promise.promise.promiseDispatch (/Users/vsts/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:749:13) at /Users/vsts/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:509:49 at flush (/Users/vsts/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/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)

dmittal02 commented 6 years ago

I was actually using 7.1. to overcome this issue, we used daemon kill and then it worked. so still suspect, it it some bug\known issue.

SpartanVFL commented 6 years ago

Using 7.1 fixed that error for me as well

nmocruz commented 6 years ago

I'm getting this one to

av09 commented 6 years ago

I have faced the same issue I resolved it by creating taco.json in the project root, specifying "cordova-cli" version like below:

{ "cordova-cli": "8.0.0" } As specified in https://github.com/Microsoft/taco-team-build#general-settings point 1, I was building it for android.

sithwarrior commented 6 years ago

@dmittal02 How did you do this?

we used daemon kill and then it worked

Im having the same issue, and using different cordova versions or createing the taco.json dosent work

tigrannajaryan commented 6 years ago

Seems to be the same problem as https://github.com/Microsoft/vsts-cordova-tasks/issues/85

drewgillies commented 6 years ago

Visual Studio 2017 (and by extension MSBuild and vsts-cordova-tasks) supports Cordova v6.3.1 only. Are there any failures using this version of Cordova?

sithwarrior commented 6 years ago

Hi Drew

If i set the cordova version to 6.3.1 i get the following error:

TypeError: cordovaProject.projectConfig.getFileResources is not a function at updateFileResources (D:\a\1\s\platforms\android\cordova\lib\prepare.js:416:46) at D:\a\1\s\platforms\android\cordova\lib\prepare.js:51:9 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) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9)

Is there a plan for getting support for higher versions of Cordova? Cordova 6.3.1 is from Aug 2016. Current version is 8.0.0

maerlynflagg commented 6 years ago

i have to use Cordova 7.1.0 or 8.0.0, because i have to support Android 8 and Android 8.1. Some customers update there devices to Android 8 and Android 8.1. my task is always support important current iOS and Android versions with my app.

so, Cordova 6.3.1 doesn't fit to the requirements. Cordova 6 only supports Android API 26. -> https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html

with Cordova 8 i get the an issue on remotebuild like the others: Cannot read property 'fail' of undefined.

currently Cordova 7.1.0 is working for Android API 27 and iOS, but if the next API only needs Cordova 8, i have a problem....

so @drewgillies i think for some or morte people important, that VS2017/remotebuild get updates to work with current Cordova versions correctly.

in worst case, i need an alternative to "remotebuild" my app on a mac... :/

drewgillies commented 6 years ago

I understand the concern, but we are not implementing support for versions other than 6.3.1 at this stage. I can't comment further now. Given this hard blocker, if there are no other 6.3.1-related concerns I'll go ahead and close this issue. I know it's not the desired outcome.

sithwarrior commented 6 years ago

Hi Drew. I really think that only supporting cordova 6.3.1 should be mentioned rather highly in all documentation, as it would be a showstopper for many.

enko commented 6 years ago

@sithwarrior I got this error on my ionic app too, changing to cordova 6.4.0 fixed this issue.

trevor-trou commented 6 years ago

Maybe this will help someone. I had been using the Ionic Command with the parameters cordova build android --release to build my app. The app would always build fine, but the task simply wouldn't complete. Even when using an earlier version of Cordova.

I instead broke the single command into two. Now I run the Ionic Command with the parameters build (to prep the ionic assets) then follow that with the Cordova Build command. This seems to work for me, so long as I use Cordova 7.1.0 for the Cordova Build command.

kyriediculous commented 6 years ago

Having this issue too.

Problem seems to solve itself when restarting Virtual device...

When using --verbose flag I'm getting

Running adb shell command "ps" on target emulator-5554...
Running command: C:\Users\N.vergauwen\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell ps
Command finished with error code 0: C:\Users\N.vergauwen\AppData\Local\Android\sdk\platform-tools\adb.exe -s,emulator-5554,shell,ps
alexgermann commented 6 years ago

@trevor-trou I tried your fix but it didn't work! Do you have any other suggestions!?

hypervtechnics commented 6 years ago

I am experiencing the same. Adding --gradleArg=--no-daemon did nothing. Temporary did this by letting the build task continue on error and set the timeout to 15 minutes. The following copy to artifact staging will do the rest and some "error handling". Ofc this is only solution which should be used only once - during testing the pipeline...

hypervtechnics commented 6 years ago

Another cool way of handling this which works for me (does not start the daemon) is to add this line as a command line before all ionic builds:

Windows: (if not exist "%USERPROFILE%/.gradle" mkdir "%USERPROFILE%/.gradle") && (echo. >> "%USERPROFILE%/.gradle/gradle.properties" && echo org.gradle.daemon=false >> "%USERPROFILE%/.gradle/gradle.properties")

Linux: mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties

Those disable the daemon by using a user wide configuration file. Taken from docs on Gradle Daemon. Thus this requires a fixed OS on the target system.

Finally I think this should be an accepted solution. Someone may put this as a more flexible script and/or specific for job.

EDIT on 17-09-2019: Additional tip from @vitmantug regarding Gradle versions >= 5.0 because:

The default was changed from 1g to 512m in Gradle 5.0. Here in my example I'm setting the memory to 2GB (Xmx2g).

penihel commented 5 years ago

Hi. I had the same problem.

I changed the "Agent pool" to "Hosted Ubuntu 1604" and worked.

bincos commented 5 years ago

Try to check one of this things:

  1. Make sure that your internet is not slower
  2. if you are running under a proxy/ please turn off your proxy may you antivirus is blocking the build processes (try disable your antivirus permanently)

this solved my case .

sambowenhughes commented 5 years ago

Any update on this?

sithwarrior commented 5 years ago

Any update on this?

As per the readme of the project. it seems to be deprecated/EOL.

As of March 2019, this repo is no longer maintained by Microsoft. If you're interested in continuing this project, please feel free to fork it. As of March 2019, we will no longer monitor or respond to open issues. Thanks for your support!

vitmantug commented 5 years ago

Another cool way of handling this which works for me (does not start the daemon) is to add this line as a command line before all ionic builds:

Windows: (if not exist "%USERPROFILE%/.gradle" mkdir "%USERPROFILE%/.gradle") && (echo. >> "%USERPROFILE%/.gradle/gradle.properties" && echo org.gradle.daemon=false >> "%USERPROFILE%/.gradle/gradle.properties")

Linux: mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties

Those disable the daemon by using a user wide configuration file. Taken from docs on Gradle Daemon. Thus this requires a fixed OS on the target system.

Finally I think this should be an accepted solution. Someone may put this as a more flexible script and/or specific for job.

I totally agree that this should be an accepted solution. After trying many solutions, this was the one that worked.

But I should add that if you try this solution and then get memory problems, you need to adjust the memory used by gradle, like this:

(if not exist "%USERPROFILE%/.gradle" mkdir "%USERPROFILE%/.gradle") && (echo. >> "%USERPROFILE%/.gradle/gradle.properties" && (echo org.gradle.daemon=false && echo org.gradle.jvmargs=-Xmx2g) >> "%USERPROFILE%/.gradle/gradle.properties")

The default was changed from 1g to 512m in Gradle 5.0. Here in my example I'm setting the memory to 2GB (Xmx2g).