8

我正在我的 phonegap 应用程序中实现 jquery.min.js,但它向我显示 CordovaWebView 超时错误。我也试过

super.setIntegerProperty("loadUrlTimeoutValue", 10000);

但它只是花时间,在那之后,同样的“CordovaWebView:超时错误!” 来了。请为我提供适当的解决方案。

4

4 回答 4

1

我猜您的主脚本太长而无法执行:

//code executed after the loading of the page (if your using jquery)
$(function() {

    //if this method is too heavy and takes too long to execute, it will trigger the TIMEOUT ERROR. 
    doSomeStuff();
});

可能不想在此方法上添加超时以让应用程序启动,然后启动您的繁重脚本(您可能希望显示加载图像或类似的东西)。

代码片段

//code executed after the loading of the page
$(function() {

    //in mobile environment, this timeout leaves time for the app to launch before we start any heavy process.
    setTimeout(function(){
        doSomeStuff();
    },100);
});
于 2013-06-10T14:17:25.177 回答
0

您可以增加超时值,请参阅此链接

super.setIntegerProperty("loadUrlTimeoutValue", 60000); 

更新

在示例中,我用这个代码段替换了我的旧代码,它可以工作:

我添加import org.apache.cordova.*super.loadUrl(Config.getStartUrl())代替了 url 方法

import org.apache.cordova.*;
import android.os.Bundle;    
public class MyApp extends DroidGap
{    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {           
        super.onCreate(savedInstanceState);
        super.loadUrl(Config.getStartUrl());            
    }
于 2013-03-30T19:02:32.633 回答
0

这是模拟器的问题,因为系统速度很慢,所以需要时间并给出 CordovaWebView 超时错误。
所以我在具有良好 RAM 的设备中运行它并且它正在工作。

于 2013-11-20T09:11:55.817 回答
0

关于从 corodova Web 视图中获取超时从同一个 AVD 重新启动应用程序将解决这个问题,您不必向应用程序发出“运行方式”命令只需从手机或 AVD 中选择应用程序并再次运行它可能是因为您的设备的速度非常慢,并且无法快速响应您为识别价值而提供的变量

我-

于 2013-08-01T09:51:22.317 回答