PhoneGap应答器在5秒钟后未启动

PhoneGap ondeviceready not firing after 5 seconds

本文关键字:启动 5秒 应答 PhoneGap      更新时间:2024-04-08

所以我目前正在使用Weinre调试我的PhoneGap应用程序,我不断收到以下错误。。。

deviceready在5秒钟后未启动。

通道未启动:onPluginsReady

通道未启动:在CordovaReady 上

通道未启动:onCordovaConnectionReady

我正在使用条形码扫描仪插件,并使用PhoneGap网站提供的远程服务进行编译。也使用PhoneGap 3.2在android 2.3。

this.initialize = function(){
    this.bindEvents();
};
this.bindEvents = function(){
    console.log('binding events...');
    document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
};
this.onDeviceReady(){
...
};

initialize函数是在body onload事件中调用的。

全新的phonegap项目是否适用于phonegap 3.2.0?我们遇到了同样的问题,事实证明,即使是股票样本网络应用程序在使用phonegap 3.2.0:运行时也会出现同样的错误

[Log] deviceready has not fired after 5 seconds. (phonegap.js, line 1078)
[Log] Channel not fired: onCordovaInfoReady (phonegap.js, line 1071)

不知道为什么。降级到3.0.0是一种变通方法:

npm install -g phonegap@3.0.0-0.14.4 cordova@3.0.10

然后创建一个新的phonegap项目,看看它是否能使用3.0.0。为我们这样做。

在我的案例中,cordova.js和插件出现了问题。我是从iOS版本得到的,而不是从Android版本,收到了一个错误。

使用以下方法。

function onDeviceReady() {
    alert("on device ready");
}
document.addEventListener("deviceready", onDeviceReady, false);