且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何解决Android的应用程序的PhoneGap语法错误:解析错误​​? (黑屏问题)

更新时间:2023-01-09 23:21:29

您首先需要解决这一点在道场常见问题:

我似乎无法运行在Android设备上的Dojo移动网页时使用   像PhoneGap的图书馆,我是什么做错了吗?

I can’t seem to run Dojo Mobile pages on Android devices when using libraries like PhoneGap, what am I doing wrong?

有一个在Android的WebKit浏览器实现一个已知的错误,   不允许开始用下划线_字符是档案   从本地文件系统加载(例如,当在使用道场移动   与PhoneGap的结合使用,以创建本机应用程序)。解决这个问题的方法   问题是创建文件的内置版本(你想做的事   这个反正性能)。

There is a known bug in the Android WebKit browser implementation that does not allow files starting with an underscore ‘_’ character to be loaded from local file system (for example, when using Dojo Mobile in conjunction with PhoneGap to create a native app). The way around this problem is to create a built version of your files (you’ll want to do this anyway for performance).

常见问题解答: http://dojotoolkit.org/reference-guide/ 1.9 / DojoX中/移动/的faq.html

此问题的确认:

http://developer.appcelerator.com/question/144171/using-dojo-mobile-and-filenames-with-

按照此版本的教程创建的Dojo应用程序的单一的JavaScript文件的建立,将废除该开始用下划线个人javascript文件:

http://dojotoolkit.org/documentation/tutorials/1.9/build/

假设你可以建立道场的应用程序确定,那么你需要遵循这个与PhoneGap的/科尔多瓦整合:

https://dojotoolkit.org/documentation/tutorials/1.9/dojox_app/contactsCordova/

* 如果您在使用deviceTheme.js问题,通知在页面中间如何显示您的PhoneGap /科尔多瓦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库或在初始实例化道场应用程序对象?此外,您使用的任何其他JavaScript库?

This is mostly a debugging issue where you need to isolate the moving parts and verify your assumptions step by step. Ensure that nothing more basic that you are assuming works is not actually broken. Perhaps the dojo.js library or the initial instantiation of you dojo app object? Also, are you using any other javascript libraries?

在我们的其他线程我提到我是如何使用Weinre弄清楚,我的煎茶的应用程序对象将不能在Android 2.3的加载。在煎茶库本身似乎加载确定,但样板调用创建我的煎茶的应用程序对象将挂了一下,然后不加载和我的UI并没有呈现在所有(白色屏幕!)。我想通了这一点做一些增量的console.log痕迹以及注释掉我的一些不同的JavaScript包括,直到问题变得清晰。它工作得很好在Android 4+,但这样也许正是在这种情况下,不同的问题。

In our other thread I mentioned how I used Weinre to figure out that my Sencha app object wouldn't load on Android 2.3. The Sencha library itself seemed to load ok but the boilerplate call to create my Sencha app object would hang for a bit and then not load and my UI didn't render at all (white screen!). I figured this out by doing some incremental console.log traces as well as commenting out some of my different javascript includes until the problem became clear. It worked fine on Android 4+ though so maybe it is a different problem in this case.