离子运行错误退出代码1设备通信超时

时间:2016-01-08 18:54:57

标签: android cordova ionic

我最近在尝试运行任何Cordova项目时遇到此错误,无论是Ionic还是纯粹的Cordova项目。

它允许我构建项目而没有任何问题,但如果我尝试使用命令ionic run androidcordova run android推送到设备或模拟器,我会收到以下错误:

Error message received through CLI

我已经做过工作,可以确认它昨天有效 平均时间没有任何改变。这是在Windows机器上。我已经格式化并重新安装了一天有用的东西然后我开始收到相同的错误。

NPM version 2.14.12
Ionic version 1.7.12
Cordova version 5.4.1
Java version 1.8.0_66

2 个答案:

答案 0 :(得分:6)

要解决此问题的黑客(但不是真正的解决方案)是修改platforms\android\cordova\node_modules\q\q.js行上的文件1716-1718

由此:

var timeoutId = setTimeout(function () {
  deferred.reject(new Error(message || "Timed out after " + ms + " ms"));
}, ms);

对此:

var timeoutId = setTimeout(function () {
  deferred.reject(new Error(message || "Timed out after " + ms + " ms"));
}, 15000);

这个hack来自另一个stackoverflow问题:Visual Studio Cordova - You may not have the required environment or OS to run this project, 由于这里有更好的问题解释,我没有将此标记为重复。

答案 1 :(得分:0)

即使我改变了它

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);

//从ms变为15000 - Rakesh Kumar Jha - 10-04-2017

但仍然在BUILD SUCCESSFUL之后,应用程序未在设备中启动

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
    包名后的
  • :com.rakesh.jha,什么都没有,CLI卡在com.rakesh.jha