[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 void onCreate(Bundle savedInstanceState)

{

super.setIntegerProperty("loadUrlTimeoutValue", 60000);

super.onCreate(savedInstanceState);

super.loadUrl(AppSetting.WEBSERVICE_LOGIN);

}

第三步
禁止横屏 

方法:

在AndroidManifest.xml的activity(需要禁止转向的activity)配置中加入android:screenOrientation=”landscape”属性即可(landscape是横向,portrait是纵向) 
或者在屏幕切换的时候保存相应的活动状态 
因为android中每次屏幕方向切换时都会重启Activity,所以应该在Activity销毁前保存当前活动的状态,在Activity再次Create的时候载入配置,那样,进行中的操作就不会自动重启了,要避免在转屏时重启activity,可以通过在androidmanifest.xml文件中重新定义方向(给每个activity加上android:configChanges=”keyboardHidden|orientation”属性),并根据Activity的重写onConfigurationChanged(Configuration
newConfig)方法来控制,这样在转屏时就不会重启activity了,而是会去调用onConfigurationChanged (Configuration
newConfig)这个钩子方法。

例如:

if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){

//横向

setContentView(R.layout.file_list_landscape);

}else{

//竖向

setContentView(R.layout.file_list);

}

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

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

时间: 2024-12-23 00:21:07

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

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的最新版本:

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

TNS-12547 Linux Error: 104: Connection reset by pe (转载)

TNS-12547 Linux Error: 104: Connection reset by peer 解决过程参考:http://blog.chinaunix.net/u/7121/showart_403812.html [[email protected] log]$ lsnrctl startLSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-JUN-2009 09:53:26 Copyright (c) 1991, 2005

Autel MaxiDAS DS708 Fatal Application Error illegal operation

I get one Original Autel MaxiDAS® DS708 Update Service, after complete update, I got a message "Fatal Application Error", reading: Application AutoRun.exe has performed an illegal operation and will be shut down. If the problem persists, contact

虚拟机中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)