问题描述:

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 秒)

@Override
publicvoid 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 -->

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

  1. 运行错误:Application Error - The connection to the server was unsuccessful

    在模拟器上上启动ionic4.6版本 打包成的android APK,启动了很久结果弹出这个问题: Application Error - The connection to the server w ...

  2. 解决ionic3 android 运行出现Application Error - The connection to the server was unsuccessful

    在真机上启动ionic3打包成的android APK,启动了很久结果弹出这个问题: Application Error - The connection to the server was unsu ...

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

    最近在更新App的时候,发现在华为手机上报这个错误,有点困惑,查找资料分析,大概原因是程序在加载index.html网页时,加载的资源过多,造成时间超时, 这个时原因分析https://stackov ...

  4. Android App启动错误的问题(connection to the server was unsuccessful)

    问题描述: PhoneGap+Sencha Touch开发的应用,打包后的APP或者调试期间,在启动的时候提示如下信息: Application Error - The connection to t ...

  5. 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 reg ...

  6. xp操作系统下配置iis,出现了server application error的解决办法

    在网上搜索了很多解决办法,最后发现一个差不多的: Server Application Error The server has encountered an error while loading ...

  7. MySQL远程连接丢失问题解决方法Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0

    最近远程连接mysql总是提示 Lost connection 很明显这是连接初始化阶段就丢失了连接的错误 其实问题很简单,都是MySQL的配置文件默认没有为远程连接配置好,只需要更改下MySQL的配 ...

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

    环境:在VirtualBox中安装了Ubuntu虚拟机,网络使用了NAT模式,开启了端口转发. 局域网内其他计算机访问虚拟机中的MySQL Server出现两个问题: Lost connection ...

  9. Runtime Error---Description: An application error occurred on the server....

    [原]Runtime Error---Description: An application error occurred on the server.... 2010-1-7阅读2010 评论3 D ...

随机推荐

  1. HTML 之 表单

    关于HTML的表单 <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset=&q ...

  2. Mount qcow2 image

    1.Mount a qcow2 image qemu-nbd - QEMU Disk Network Block Device Server: Export QEMU disk image using ...

  3. BZOJ 4815 CQOI2017 小Q的表格 欧拉函数+分块

    题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=4815 题意概述:要认真概述的话这个题就出来了... 分析: 首先分析题目,认真研究一下修 ...

  4. Agri-Net(最小生成树)

    Description Farmer John has been elected mayor of his town! One of his campaign promises was to brin ...

  5. M2迭代分数分配

    M2中仍然依据每个成员的工作量,贡献度分配相应得分. 成员 得分 申开亮 25 王皓南 24 许晋 21 黄玉冰 20 王宇杰 18 吴润凡 17 巴丹益昔 15

  6. 实现虚拟机VMware上Centos的linux与windows互相复制与粘贴

    转自:http://blog.csdn.net/u012243115/article/details/40454063 1.打开虚拟机的菜单“虚拟机”,下拉框中会有一个“安装 VMwareTools” ...

  7. Android框架 与 源码结构

    一. Android 框架 Android框架层级 : Android 自下 而 上 分为 4层; -- Linux内核层; -- 各种库 和 Android运行环境层; -- 应用框架层; -- 应 ...

  8. Java package和import语句

    Java中的package和import语句 如果你想让其他人访问你的类,你一定要把你写的类放到正确的子目录下. 在Java里,对于位于包中的类是这样管理的: Java编译器把包对应于文件系统的目录管 ...

  9. JAVA mysql数据库 配置

    mysql 版本 5.7 数据库连接版本 <!--MySql--><dependency> <groupId>mysql</groupId> <a ...

  10. Debian 7 amd64--TP-LINK TL-WN725N 2.0源码驱动编译安装

    租房用的是无线网络,在新安装的Debian 7 amd64使用的无线网卡型号是TP-LINK TL-WN725N 2.0,发现驱动安装还是有些问题,折腾了很久,特意在此记录一下. TL-WN725N ...