【问题标题】:"deviceready has not fired after 5 seconds.","deviceready 5 秒后未触发​​。",
【发布时间】:2016-06-24 10:06:00
【问题描述】:

我在 genymotion android 模拟器上运行我的 cordova android 应用程序时收到 "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1185)

到目前为止我尝试了什么?

我已经从 CLI 安装了cordova plugin add org.apache.cordova.file 并将<preference name="AndroidPersistentFileLocation" value="Compatibility" /> 添加到我的config.xml 文件中仍然没有运气,我正在为谷歌找到任何合适的解决方案。

我是cordova 的新手,到目前为止我所学到的deviceReady 是在applicationbooting 之后触发的函数。

【问题讨论】:

    标签: javascript cordova phonegap-plugins


    【解决方案1】:

    你用的是什么版本的cordova?

    <script>
     document.addEventListener("deviceready", onDeviceReady, false);function onDeviceReady(){//alert("ondeviceready");}
    </script>
    

    【讨论】:

    • onDeviceReady()函数在哪里??
    • 我想把两个javascript文件放在onDeviceReady() {
    • 您需要在代码中添加onDeviceReady() 事件处理程序。你在正确的轨道上,但你不能像这样在 JavaScript 中放置 HTML 标签。将这些 .js 文件中的内容复制到 onDeviceReady。看这个例子:cordova.apache.org/docs/en/latest/cordova/events/events.html
    • 你可以试试这个 => document.write(""); document.write("");
    猜你喜欢
    • 2015-02-23
    • 2016-03-29
    • 2015-12-16
    • 2014-08-28
    • 2015-09-20
    • 1970-01-01
    • 1970-01-01
    • 2017-03-14
    • 1970-01-01
    相关资源
    最近更新 更多