问题描述:

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

Android App启动错误的问题(connection to the server was unsuccessful)的更多相关文章

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

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

  2. Android app启动activity并调用onCreate()方法时都默默地干了什么?

    Android app启动activity并调用onCreate() 方法时都默默地干了什么?   在AndroidManifest.xml文件中的<intent-filter>元素中有这 ...

  3. [FMX] Android APP 启动黑屏优化补丁

    使用说明 *************************************************** Android APP 启动黑屏优化补丁 作者: Swish, YangYxd 201 ...

  4. android app启动就闪退怎么办?

    开发过程中,如遇到android app启动就闪退,不要急,直接进入调试模式运行app,就会取得出错的原因. http://blog.sina.com.cn/s/blog_44fa172f0102wg ...

  5. Android App 启动页(Splash)黑/白闪屏现象产生原因与解决办法(转)

    转载: Android App 启动页(Splash)黑/白闪屏现象产生原因与解决办法   首先感谢博主分享,本文作为学习记录 惊鸿一瞥 微信的启动页,相信大家都不陌生. 不知道大家有没有发现一个现象 ...

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

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

  7. K8s - 解决主机重启后kubelet无法自动启动问题 错误:The connection to the server 192.168.60.128:6443 was refused - did you specify the right host or port?

    1,问题描述 (1)在安装配置好 Kubernetes 后,正常情况下服务器关机重启,kubelet 也会自动启动的.但最近配置的一台服务器重启后,输入命令 kubectl get nodes 查看节 ...

  8. Apache/2.4.9启动错误:AH01630: client denied by server configuration

    在升级Yii框架1.11->2.0beta时,PHP升级到5.5.顺带升级Apache2.2.x到2.4.9. 把原有vhost配置移植过来,出现Apache启动错误: AH01630: cli ...

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

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

随机推荐

  1. magento中某个商店实现部分样式

    在magento的某个website中,已经有一个storeview A,现在要求在这个website下再创建一个新的storeview B,现在要求对于storeview B只有主页和分类页应用新的 ...

  2. day10_面向对象第五天

    1.包(掌握) 1.概念(掌握)       包就是文件夹,用于区分相同的类名 2.声明格式      package 包名1.包名2-.;      package:是个关键字3.带包的类的编译和运 ...

  3. hadoop常用基础命令

    1.日志查询: 用户可使用以下命令在指定路径下查看历史日志汇总$ bin/hadoop job -history output-dir 这条命令会显示作业的细节信息,失败和终止的任务细节. 关于作业的 ...

  4. 十一 SOA 与 ESB

    一 SOA 1. 定义: a) 一种充分利用开放标准,将软件资产展现为服务的结构. b) 提供软件资产标准的展现和交互途径 c) 在开发其他应用的时候,可以将独立的软件资产封装为一个一个的“积木”. ...

  5. Customize R initiallization in Mac

    First, we need to find a "Rprofile" document. locate Rprofile Then we find Rprofile docume ...

  6. Sublime text2如何设置快捷键让编写的HTML文件在浏览器预览?

    著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处.作者:浪人链接:http://www.zhihu.com/question/27219231/answer/43608776来源:知 ...

  7. 神逸之作:国产快速启动软件神品ALTRun

    http://xbeta.info/altrun.htm 作者: ET民工和塞壬 日期: 2010-09-15 分类: windows 标签: quick-launch <神逸之作:国产快速启动 ...

  8. Map/Reduce的类体系架构

    Map/Reduce的类体系架构 Map/Reduce案例解析: 先以简单的WordCount例程, 来讲解如何去描述Map/Reduce任务. public static void main(Str ...

  9. smartUpload组件批量下载

    public class BatchDownloadServlet extends HttpServlet { public void doGet(HttpServletRequest request ...

  10. leetcode 97 Interleaving String ----- java

    Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = ...