jQuery Mobile的+的PhoneGap为Android - 错误加载的index.html [英] JQuery Mobile + PhoneGap for Android - Error loading index.html

查看:135
本文介绍了jQuery Mobile的+的PhoneGap为Android - 错误加载的index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得一个基本的的PhoneGap + jQuery Mobile的运行 Android平台2.2 ,但我正在一个应用程序错误连接到服务器程序不成功在Android模拟器:(文件///android_asset/www/index.html)当我尝试运行在 Windows XP中的Eclipse 3.7

I am trying to get a basic PhoneGap + JQuery Mobile program running for Android platform 2.2, but I am getting an Application Error "The Connection to the server was unsuccessful (file:///android_asset/www/index.html)" in the Android Emulator when I try to run the application in Android Emulator platform 2.2 on Windows XP, with Eclipse 3.7.

如果我删除从HTML文件中的所有引用和jQuery Mobile的语法,所以我敢肯定,我的项目是好的,但有件事情我很想念使用jQuery Mobile的初始化文件加载。我使用的 PhoneGap的0.9.6 jQuery Mobile的版本*的 1.0b1 的* JQuery的版本1.6.1 (我也试图与JQM版本1.0a2使用jQuery 1.4.4,但具有相同的错误)。

The file loads if I remove all references and syntax of JQuery Mobile from the HTML file, so I am certain that my project is fine but there's something I am missing with initialization of JQuery Mobile. I am using PhoneGap 0.9.6 with JQuery Mobile version *1.0b1* with JQuery version 1.6.1 (I also tried with JQM Version 1.0a2 with JQuery 1.4.4 but with the same error).

如果我删除我的HTML文件,jQuery Mobile的所有引用,那么我能够无差错加载程序在模拟器。

If I remove all references to JQuery Mobile from my HTML file then I am able to load the program in the emulator without errors.

我看了看网络上的几个例子,并试图他们,因为他们是,但他们都表现出同样的错误。我的文件如下:

I looked at several examples on the web and tried them as they are, but all of them show the same error. My files are as:

<!DOCTYPE HTML>
<html>
  <head>
    <meta name="viewport" content="width=320; user-scalable=no" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>PhoneGap With JQM</title>
      <link rel="stylesheet" href="jquery.mobile-1.0b1.min.css" type="text/css" charset="utf-8" />
        <script src="jquery-1.6.1.min.js"></script>
          <script type="text/javascript" charset="utf-8" src="phonegap.0.9.6.js"></script>
          <script type="text/javascript" charset="utf-8" src="main.js"></script>  
          <script src="jquery.mobile-1.0b1.min.js"></script>

  </head>
  <body onload="init();">
    <div data-role="page" data-theme="e">
        <div data-role="header">
            <h1>PhoneGap with JQM</h1> 
        </div>
        <div data-role="content">
            <h1>My Content</h1>  
        </div>
        <div data-role="footer">
            <h1>My Footer</h1>  
        </div>
  </body>
</html>

在main.js文件只有:

The main.js file has only:

function init()
{   
    document.addEventListener("deviceready", deviceInfo, true);             
}       

我在想什么?

What am I missing?

推荐答案

这个问题可能是由于仿真器的速度,使网络速度太慢完成及时的沟通。

The problem is likely due to the speed of the emulator so the network is too slow complete the communication in a timely fashion.

通过增加以下属性设置在PhoneGap的60秒超时的src / COM /的PhoneGap / xxx.java

Set a 60 second timeout in PhoneGap by adding the following property to src/com/phonegap/xxx.java:

super.setIntegerProperty("loadUrlTimeoutValue", 60000); 

参考文献:

<一个href="http://groups.google.com/group/phonegap/browse_thread/thread/3336e5dfbb98120e/571aa73d49446092?lnk=gst&q=The+connection+to+the+server+was+unsuccessful#571aa73d49446092">phonegap 0.9.3 onReceivedError:错误code = -6说明=到服务器的连接失败

<一个href="http://comments.gmane.org/gmane.comp.handhelds.phonegap/7943">http://The%20connection%20To%20The%20Server%20Was%20Unsuccessful%20-%20Android%202.2,%20jquerymobile,%200.9.5.1

这篇关于jQuery Mobile的+的PhoneGap为Android - 错误加载的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆