Reputation: 33
I recently started getting this error when trying to run any Cordova project, whether it is Ionic or just a plain Cordova project.
It allows me to build the project without any issues but if I try to use the commands ionic run android
or cordova run android
to push to a device or emulator I get the error below:
I have worked on and can confirm that it was working yesterday.
Nothing changed in the mean time. This is on a Windows machine. I have formatted and reinstalled everything which helped for a day then I started receiving the same errors.
NPM version 2.14.12
Ionic version 1.7.12
Cordova version 5.4.1
Java version 1.8.0_66
Upvotes: 3
Views: 2344
Reputation: 2780
Even though I changed it
Promise.prototype.timeout = function (ms, error) {
var deferred = defer();
var timeoutId = setTimeout(function () {
if (!error || "string" === typeof error) {
error = new Error(error || "Timed out after " + ms + " ms");
error.code = "ETIMEDOUT";
}
deferred.reject(error);
}, 15000);
//change from ms to 15000 - Rakesh Kumar Jha - 10-04-2017
but still after BUILD SUCCESSFUL, application is not launching in device
BUILD SUCCESSFUL
Total time: 7.304 secs
Built the following apk(s):
C:/Rakesh_Kumar_Jha/BCodeScanApp/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=C:\Users\kumarjha\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112
No target specified, deploying to device '494faea'.
Skipping build...
Built the following apk(s):
C:/Rakesh_Kumar_Jha/BCodeScanApp/platforms/android/build/outputs/apk/android-debug.apk
Using apk:
C:/Rakesh_Kumar_Jha/BCodeScanApp/platforms/android/build/outputs/apk/android-debug.apk
Package name: com.rakesh.jha
Upvotes: 0
Reputation: 3207
A hack to solve this (but not a real solution) is to modify file platforms\android\cordova\node_modules\q\q.js
on line 1716-1718
From this:
var timeoutId = setTimeout(function () {
deferred.reject(new Error(message || "Timed out after " + ms + " ms"));
}, ms);
To this:
var timeoutId = setTimeout(function () {
deferred.reject(new Error(message || "Timed out after " + ms + " ms"));
}, 15000);
This hack comes from this other stackoverflow question: Visual Studio Cordova - You may not have the required environment or OS to run this project , I didn't mark this one as duplicate because of this better question explanation here.
Upvotes: 6