Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

问题描述:

PhoneGap+Sencha Touch开发的应用,打包后的APP或者调试期间,在启动的时候提示如下信息:

Application Error - The connection to the server was unsuccessful. 
(file:///android_asset/www/index.html)

问题分析:

这个应该是PhoneGap某些版本的BUG,尤其在index.html加载的内容较多时容易出现。

解决方法:

方法1:更新到PhoneGap的最新版本;

方法2:设置加载超时属性

super.setIntegerProperty("loadUrlTimeoutValue",10000);  

完整代码如下(设置超时为 10 秒)

@Overridepublicvoid onCreate(Bundle savedInstanceState){    super.onCreate(savedInstanceState);    super.loadUrl("file:///android_asset/www/home/index.html");    super.setIntegerProperty("loadUrlTimeoutValue",10000);}

方法3:改名法

把index.html更名为main.html,然后新建一个index.html页面,内容如下:

<!doctype html> <html> <head> <title>tittle</title> <script> window.location=‘./main.html‘; </script> <body> </body> </html>

主要原理就是通过一个过渡页面,把加载首页的内容最小化。

找到项目中res/xml目录下的config.xml,把你的外网的域名地址添加到配置中 
<access origin="http://example.com" /> <!--allow any secure requests to example.com -->

时间: 2024-08-28 22:40:15

Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)的相关文章

[Android_Bug]处理PhoneGap Application Error: "The connection to the server was unsuccessful.(file:///android_asset/www/index.html)"的错误

android 在log中提示TimeOut Error后,应用程序弹出application error the connection to the server was unsuccessful 的错误的处理方法: 第一步 找到项目中res/xml目录下的config.xml,把你的外网的域名地址添加到配置中     <access origin="http://example.com" /> 第二步 在activity的onCreate方法中加入一行代码 public

Ionic App 启动时报Application Error - The connection to the server was unsuccessful

最近在更新App的时候,发现在华为手机上报这个错误,有点困惑,查找资料分析,大概原因是程序在加载index.html网页时,加载的资源过多,造成时间超时, 这个时原因分析https://stackoverflow.com/questions/12319809/application-error-the-connection-to-the-server-was-unsuccessful-file-andr 具体的解决方案是在config.xml文件中添加如下延时设置: <!--解决程序启动问题:A

kubectl error: The connection to the server localhost:8080 was refused

did you run below commands after kubeadm init To start using your cluster, you need to run (as a regular user): sudo cp /etc/kubernetes/admin.conf $HOME/ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf ref: https://gi

虚拟机中MySQL连接问题:Lost connection to MySQL server at &#39;reading initial communication packet, system error: 0 以及 host is not allowed to connect mysql

环境:在VirtualBox中安装了Ubuntu虚拟机,网络使用了NAT模式,开启了端口转发. 局域网内其他计算机访问虚拟机中的MySQL Server出现两个问题: Lost connection to MySQL server at 'reading initial communication packet, system error: 0 以及 host is not allowed to connect mysql 1.解决Lost connection to MySQL server

mysqldump导出报错&quot;mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29&quot;

今天mysql备份的crontab自动运行的时候,出现了报警,报警内容如下 mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29 mysqldump: Couldn't execute 'show table status like 'property'': MySQL server has gone away (2006)

Error NO.2013 Lost connection to Mysql server during query

系统:[[email protected] ~]# cat /etc/redhat-release CentOS release 6.3 (Final) DB版本:mysql> select @@version;+------------+| @@version  |+------------+| 5.6.26-log |+------------+ 数据中心部门申请线上数据库select权限,直接grant  select on DB.* to 'username'@'IP' identifi

Error 20002 (severity 9):Adaptive Server connection failed

环境: Ubuntu12.10_x64 问题: 用tsql访问SQL Server >> tsql -H 192.168.88.133 -p 1433 U sa Error 20002 (severity 9): Adaptive Server connection failed 解决: 查看TDS version >> tsql -C Compile-time settings (established with the "configure" script)

MySQL报错:ERROR 2013 (HY000): Lost connection to MySQL server during query

首先贴上实验用各版本: OS:CentOS 6.5 MySQL: mysql> select version ();+------------+| version () |+------------+| 5.6.22     |+------------+1 row in set (0.00 sec) 事情是这样的:本来是要在虚机上搭建一个wordpress做实验,刚创建完数据库,就在赋权额时候发生不在计划的错误: mysql>grant all on wordpress.* to [emai

The connection to adb is down, and a severe error has occured. Android ADB server didn&#39;t ACK * failed to start daemon. 解决方案

ADB server didn't ACK 这个问题会困恼很多的新手朋友,我以前刚开始做Android的时候也遇到过这个问题,不过自己百度,google啥的,也不知道怎么就给解决了,看到群里很多新手朋友都会问这个问题,说实话我也没有一个解决这个问题的终极方法(百试百灵的那种,哈哈),自己没遇到也没有认真的去对待他,今天,就是在今天,我打开Eclipse连上手机,准备调试程序,出现如下的信息 The connection to adb is down, and a severe error has