【问题标题】:phonegap: Timeout error calling webviewclientphonegap:调用 webviewclient 超时错误
【发布时间】:2012-02-29 06:29:28
【问题描述】:

我正在尝试调试我的 phonegap 应用程序。当我尝试在我的模拟器上打开我的应用程序时,我收到一条错误消息 The connection to the server was unsuccessful. (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>

【问题讨论】:

    标签: android cordova timeout socket-timeout-exception


    【解决方案1】:

    增加主要(phonegap)活动的超时时间:

    setIntegerProperty("loadUrlTimeoutValue", 30000);
    

    【讨论】:

    • 正如我所说:“在您的主要(phonegap)活动中”您初始化 web 视图。
    【解决方案2】:

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

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

    【讨论】:

    • 感谢您的回答。 JQuery 的路径是由我定义的,它是正确的。调试很好,不幸的是,这也不是导致问题的原因。这可能与 phonegap 构建有关。我可能需要更彻底地查看文档,看看我是否在应用程序的设置方式上遗漏了一些东西。不过感谢您的回答。
    • 您可能最好向 PhoneGap Build 人员寻求帮助以获得满意:community.phonegap.com/nitobi/products/…
    • 谢谢你,Simon - 我不知道那个社区。您是否愿意将您的答案更改为对该社区的引用,以便我可以接受它作为答案,还是违反 SO 政策?
    • 嗯,没什么大不了的。如果您发现问题所在,请返回此处并编辑您的问题,以便其他可能遇到相同问题的人查看解决方案。
    • 我有同样的问题,但奇怪的是我的代码中没有任何外部链接。但我仍然收到此错误。请帮帮我。
    猜你喜欢
    • 2013-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-03
    • 1970-01-01
    • 1970-01-01
    • 2017-02-20
    • 1970-01-01
    相关资源
    最近更新 更多