我正在使用phonegap构建一个enyo应用程序。我的程序在chrome上运行得很好,也可以在黑莓的波纹仿真器服务上运行。我的问题是,当我使用用于webOS的.ipk版本和用于安卓的.apk版本时,我得到了相同的错误:
Not allowed to load local resource: file:///usr/palm/enyo.js
Uncaught ReferenceError: enyo is not defined, package.js:1
Uncaught ReferenceError: enyo is not defined, tests/package.js:1
Uncaught ReferenceError: enyo is not defined, index.html:10这使我认为这一定是我的索引文件中的问题,即:
<!DOCTYPE html>
<html>
<head>
<title>Enyo Bootplate App</title>
<link rel="shortcut icon" href="assets/favicon.ico">
<!-- -->
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- look this up for blackberry ad error -->
<!-- css -->
<link href="build/enyo.css" rel="stylesheet">
<link href="build/app.css" rel="stylesheet">
<!-- js -->
<script src="enyo/enyo.js"></script>
<script src="phonegap.js"></script>
<script src="source/mobile.js" type="text/javascript" ></script>
<script type="text/javascript" src="http://www.blackberry.com/app_includes/asdk/adBanner.js"></script>
<script src="source/gameBanks.js" type="text/javascript"></script>
<script src='https://cdn.firebase.com/v0/firebase-auth-client.js' type='text/javascript'></script>
<script src="https://static.firebase.com/v0/firebase.js" ></script>
<script src="build/enyo.js" ></script>
<script src="build/app.js" onerror="alert('No application build found, redirecting to debug.html.'), location='debug.html';"></script>
</head>
<body class="enyo-unselectable">
<script>
new App().write();
</script>
</body>
</html>奇怪的是,index.html:10是一个注释( css注释),所以我不知道错误怎么会出现在那里。有人知道为什么我会收到这个错误吗?或者"file:///usr/palm/enyo.js“”是什么?这不是我包里的文件。
另外,稍微修改一下之后,在index.html的顶部添加几行代码并没有改变错误所在的位置(index.html:10),所以有没有可能这个错误引用了其他形式的index.html?我在github上完成了我的提交,除了index.html:10行的注释之外,没有任何其他的东西。
更新:当使用任何其他服务打包应用程序时,比如palm-run,它会正确地更新我的代码。我从phonegap下载的版本不能正常工作。为什么phonegap的构建会导致这个问题呢?
发布于 2013-01-27 03:01:20
最终解决了这个问题,phonegap以某种方式找到了错误的index.html文件。当我下载enyo bootplate时,在api和tools文件夹中有一些index.html。在我移除它们之后,它就正常工作了。
发布于 2013-01-26 00:01:34
Strange...not确定是什么导致了这种情况,但我确实看到您试图加载enyo.js两次。我怀疑这就是问题所在,但这是你想要澄清的事情。
如果您从没有更改的基本引导板项目开始,那么打包一个ipk/apk是否有效?
https://stackoverflow.com/questions/14516694
复制相似问题