发布于 3年前

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

一:android app 启动错误,即出现:Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)分析:是PhoneGap某些版本的BUG,尤其在index.html加载的内容较多的时候容易出现,反正我是遇到过好多次 解决办法:(2,3都验证过,有效)

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

方法2:设置加载超时属性 super.setIntegerProperty("loadUrlTimeoutValue",10000); 完整代码如下: @Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.loadUrl("file:///android_asset/www/home/index.html"); super.setIntegerProperty("loadUrlTimeoutValue", 10000);

方法3:过渡法: 将indext.html更名为main.html,然后新建一个index.html页面,内容如下: 主要原理就是通过一个过渡页面,把加载首页的内容最小化。

二:PhoneGap Android Error initializing Cordova:Class not found分析:环境配置有问题 解决办法(试验有效): 将安装包中的xml/config.xml拷到项目中res/xml下面(没有xml文件夹则创建一个)

三:config.xml文件中的 这个地方写错了仔细查查

©2020 edoou.com   京ICP备16001874号-3