本文介绍了5秒后科尔多瓦3.5 deviceready事件不解雇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级从科尔多瓦到V2.9我V3.5.0科尔多瓦的应用程序。通过命令行添加插件后,我导入我的应用程序日食,这样我可以在Android设备上进行测试。但是,当我运行应用程序,我请参阅下面的logcat消息:

  11月7日至8日:24:03.359:I / Web控制台(1500):deviceready 5秒后还没有解雇。在文件中:///android_asset/www/cordova/cordova.js:115411月7日至8日:24:03.359:D / CordovaLog(1500):文件:///android_asset/www/cordova/cordova.js:行1147:通道没有被解雇:onFileSystemPathsReady11月7日至8日:24:03.359:I / Web控制台(1500):通道没有被解雇:onFileSystemPathsReady在file:///android_asset/www/cordova/cordova.js:1147

,我只好绑定 deviceready 的document.ready()。它不火。也试过外面结合它的document.ready()根据对SO一些答案。仍然没有运气。有人可以帮我???

设备准备好事件绑定

 函数cordovaInit(){
    document.addEventListener(deviceready',initApp,FALSE);
}

我称之为 cordovaInit()的onload()正文元素象下面这样:

 <身体的onload =cordovaInit()>

该deviceready问题是现在没有了,但我下面得到一个空指针异常:

  18 07-08:58:40.750:W / System.err的(6670):显示java.lang.NullPointerException
07-08 18:58:40.750:W / System.err的(6670):在org.apache.cordova.file.LocalFilesystem.filesystemPathForURL(LocalFilesystem.java:67)
07-08 18:58:40.750:W / System.err的(6670):在org.apache.cordova.file.LocalFilesystem.getFileForLocalURL(LocalFilesystem.java:189)
07-08 18:58:40.750:W / System.err的(6670):在org.apache.cordova.file.FileUtils.getFile(FileUtils.java:749)
07-08 18:58:40.760:W / System.err的(6670):在org.apache.cordova.file.FileUtils.access $ 5(FileUtils.java:742)
07-08 18:58:40.760:W / System.err的(6670):在org.apache.cordova.file.FileUtils $ 16.run(FileUtils.java:397)
07-08 18:58:40.760:W / System.err的(6670):在org.apache.cordova.file.FileUtils $ 23.run(FileUtils.java:525)
07-08 18:58:40.760:W / System.err的(6670):在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-08 18:58:40.760:W / System.err的(6670):在java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:569)
07-08 18:58:40.760:W / System.err的(6670):在java.lang.Thread.run(Thread.java:856)


解决方案

同样的问题。尝试删除/更新文件的插件,(org.apache.cordova.file)
 它是为我工作。
OnFileSystemReady是插件的事件。

I recently upgraded my cordova app from cordova v2.9 to v3.5.0. After adding plugins from command-line, I imported my app to eclipse so that I can test on an android device. But, when I run the app, I see below logcat message:

07-08 11:24:03.359: I/Web Console(1500): deviceready has not fired after 5 seconds. at file:///android_asset/www/cordova/cordova.js:1154

07-08 11:24:03.359: D/CordovaLog(1500): file:///android_asset/www/cordova/cordova.js: Line 1147 : Channel not fired: onFileSystemPathsReady

07-08 11:24:03.359: I/Web Console(1500): Channel not fired: onFileSystemPathsReady at file:///android_asset/www/cordova/cordova.js:1147

According to Cordova Device ready doc, I had to bind deviceready inside document.ready(). It did not fire. Also tried binding it outside document.ready() according to some answers on SO. Still no luck. Can someone help me out???

Device ready event binding

function cordovaInit() {
    document.addEventListener('deviceready', initApp, false);
}

I call cordovaInit() from onload() of body element like below:

<body onload="cordovaInit()">

The deviceready issue is gone now, but I am getting a Nullpointer Exception as below:

07-08 18:58:40.750: W/System.err(6670): java.lang.NullPointerException
07-08 18:58:40.750: W/System.err(6670):     at org.apache.cordova.file.LocalFilesystem.filesystemPathForURL(LocalFilesystem.java:67)
07-08 18:58:40.750: W/System.err(6670):     at org.apache.cordova.file.LocalFilesystem.getFileForLocalURL(LocalFilesystem.java:189)
07-08 18:58:40.750: W/System.err(6670):     at org.apache.cordova.file.FileUtils.getFile(FileUtils.java:749)
07-08 18:58:40.760: W/System.err(6670):     at org.apache.cordova.file.FileUtils.access$5(FileUtils.java:742)
07-08 18:58:40.760: W/System.err(6670):     at org.apache.cordova.file.FileUtils$16.run(FileUtils.java:397)
07-08 18:58:40.760: W/System.err(6670):     at org.apache.cordova.file.FileUtils$23.run(FileUtils.java:525)
07-08 18:58:40.760: W/System.err(6670):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-08 18:58:40.760: W/System.err(6670):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-08 18:58:40.760: W/System.err(6670):     at java.lang.Thread.run(Thread.java:856)
解决方案

Same issue. Try to remove/update the File plugin, (org.apache.cordova.file) it's worked for me.OnFileSystemReady is an event of that plugin.

这篇关于5秒后科尔多瓦3.5 deviceready事件不解雇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 10:53