您首先需要在 DOJO FAQ 中解决这一点:
使用时我似乎无法在 Android 设备上运行 Dojo Mobile 页面
像 PhoneGap 这样的库,我做错了什么?
Android WebKit 浏览器实现中存在一个已知错误
不允许以下划线“_”字符开头的文件
从本地文件系统加载(例如,当在
与 PhoneGap 结合创建本机应用程序)。解决这个问题的方法
问题是创建文件的构建版本(您需要这样做
无论如何,这都是为了性能)。
FAQ: http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/faq.html http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/faq.html
该问题的确认:
http://developer.appcelerator.com/question/144171/using-dojo-mobile-and-filenames-with- http://developer.appcelerator.com/question/144171/using-dojo-mobile-and-filenames-with-
按照此构建教程创建 DOJO 应用程序的单个 javascript 文件构建,这将消除以下划线开头的各个 javascript 文件:
http://dojotoolkit.org/documentation/tutorials/1.9/build/ http://dojotoolkit.org/documentation/tutorials/1.9/build/
假设您可以构建 DOJO 应用程序,那么您需要按照以下步骤与 Phonegap/Cordova 集成:
https://dojotoolkit.org/documentation/tutorials/1.9/dojox_app/contactsCordova/ https://dojotoolkit.org/documentation/tutorials/1.9/dojox_app/contactsCordova/
*如果您在使用 deviceTheme.js 时遇到问题,请注意页面中间它如何显示您的 Phonegap/Cordova index.html 文件应如下所示:
// Your device Theme
<script src="{path_to_dojox}/dojox/mobile/deviceTheme.js"></script>
// Loads cordova
<script src="cordova.js"></script>
// Loads DOJO
<script src="{path_to_dojo}/dojo/dojo.js" data-dojo-config="app: {debugApp: 1}, async: true"></script>
// DOJO then uses this require statement to load your built DOJO app
<script>
require(["contactsApp/contacts"]);
</script>
在我们下线之前帮助@nffdiogosilva解决这个问题的原始想法:
这主要是一个调试问题,您需要隔离移动部件并逐步验证您的假设。确保您假设的工作中没有任何更基本的内容实际上没有被破坏。也许是 dojo.js 库或 dojo 应用程序对象的初始实例?另外,你还使用其他 JavaScript 库吗?
在我们的其他线程中,我提到了如何使用 Weinre 来确定我的 Sencha 应用程序对象无法在 Android 2.3 上加载。 Sencha 库本身似乎加载正常,但创建 Sencha 应用程序对象的样板调用会挂起一段时间,然后无法加载,并且我的 UI 根本没有渲染(白屏!)。我通过进行一些增量 console.log 跟踪以及注释掉一些不同的 javascript 包含来解决这个问题,直到问题变得清晰为止。它在 Android 4+ 上运行良好,所以在这种情况下可能是一个不同的问题。