PhoneGap: 调用WebviewClient时超时错误

4
我正在尝试调试我的phonegap应用程序。当我尝试在模拟器上打开我的应用程序时,会出现一个错误,显示“服务器连接失败。(file:///android_asset/www/index.html)”
我应该提到我正在使用phonegap构建,所以我没有任何本地代码。奇怪的是,我只加载本地资源,所以我不知道为什么会超时。我的index.html看起来像这样:
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" />
    <title>Mængderabat - spar mere</title>
    <script src="http://debug.phonegap.com/target/target-script-min.js#maengderabat"></script>
    <script src="phonegap.js" charset="utf-8"></script>
    <script src="assets/js/jquery-1.5.2.min.js"></script>
    <script src="assets/js/jquery.mobile.js"></script>
    <script src="assets/js/jquery.jfeed.pack.js"></script>

    <link rel="stylesheet" href="assets/css/jquery.mobile.css" />
    <style>
    .ui-li-icon{width:16px;height:16px;}
    </style>
</head>
<body >
<!-- begin first page -->
<section id="main" data-role="page" data-theme="b">
    <header data-role="header">
        <h1>Mængderabat - spar mere</h1>
    </header>
    <div data-role="content" class="content">
        <ul id="list" data-role="listview" data-inset="true">
        </ul>
    </div>

    <footer data-role="footer">
        <h2>example by Oikos Development</h2>
    </footer>
</section>
<!-- end first page -->
    </body>
</html>
2个回答

1
增加您的主要 (PhoneGap) 活动中的超时时间:
setIntegerProperty("loadUrlTimeoutValue", 30000);

就像我说的:“在你的主要(phonegap)活动中”,你需要初始化webview。 - Siarhei

0

我对PhoneGap Build不是特别熟悉,但你的jQuery路径正确吗?如果在你的www文件夹中有一个js文件夹,我认为它应该是js/jquery*。

另外,你正在从debug.phonegap.com加载远程资源。可能会拖慢你的速度。


感谢您的回答。JQuery路径是我定义的,是正确的。调试很好,但不幸的是这并不是问题的原因。可能与PhoneGap构建有关的更微妙的问题。我可能需要更仔细地查看文档,以查看是否在应用程序设置方面错过了某些内容。还是感谢您的回答。 - Jakob
1
你最好向PhoneGap Build的人在getsatisfaction上寻求帮助:http://community.phonegap.com/nitobi/products/nitobi_phonegap_build?from_gsfn=true - Simon MacDonald
谢谢Simon - 我不知道那个社区。你能否修改你的答案,将其引用到那个社区,这样我就可以接受它作为答案了,或者这违反了SO的政策? - Jakob
没关系,这不是什么大问题。如果你找到了问题所在,就回到这里编辑你的问题,让其他可能遇到同样问题的人看到解决方案。 - Simon MacDonald
我有同样的问题,但奇怪的是我的代码中没有任何外部链接。但我仍然遇到了这个错误。请帮帮我。 - Anil Kumar

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接