应用程序错误 - 与服务器的连接失败.(file:///android_asset/www/index.html) [英] Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

查看:29
本文介绍了应用程序错误 - 与服务器的连接失败.(file:///android_asset/www/index.html)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序在启动时死亡(连接到服务器失败)

App Dies On Startup (connection to the server was unsuccessful)

我有一个使用 PhoneGap BUILD 编写的 Android 应用程序.该应用程序之前运行良好,但现在我似乎在优化我的应用程序后收到此错误(仅某些 UI 更改)

I have an Android application that I'm writing using PhoneGap BUILD. The app was working fine earlier, but now it seems I am getting this error after refining my app (some UI changes only)

1) 当我启动应用程序时,我(通常)得到:

1) When I start the app I (usually) get:

应用程序错误 - 与服务器的连接失败.(file:///android_asset/www/index.html)

对不起,如果这是任何问题的重复.我在这里看到了一些类似的问题,但我找不到完美的答案或解决方案.就像我的情况一样,在我最后一次更改之前它运行良好.

Sorry if this is duplication of any question. I have seen some similar questions here, but i couldn't find a perfect answer or solution. As in my case it was working fine until my last changes.

推荐答案

正如你所说,同一主题有很多重复的问题.无论如何解释你的情况.

As you said, there are many duplicate questions on the same topic. Any how explaining your situation.

这个问题可能会通过添加一个超时来解决你的 index.html

The problem might be solved by adding a timeout to call your index.html

即你需要在你的activity.java文件中添加super.setIntegerProperty("loadUrlTimeoutValue", 70000);(在src/com/yourProj/--/youractivity.java中)在这一行之上:super.loadUrl("file:///android_asset/www/index.html");

ie you need to add super.setIntegerProperty("loadUrlTimeoutValue", 70000); in your activity.java file ( inside src/com/yourProj/--/youractivity.java) above this line: super.loadUrl("file:///android_asset/www/index.html");

说明:

这可能是由于以下原因造成的

This can be happened due to the following reasons

核心原因:问题很可能是模拟器速度太慢导致无法及时完成通信.

The core reason: the problem is likely due to the speed of the emulator so the network is too slow complete the communication in a timely fashion.

这可能是由于:

  1. 你的代码/数据/图片太大了(我猜你在使用一些图片,正如你所说的你做了一些 UI 修改,可能是图片的大小很大)
  2. 您的脚本可能有无限循环或长循环,因此加载时间过长.
  3. 您将使用过多的脚本(jQuery、iscroll 等.更多的插件或脚本)

这篇关于应用程序错误 - 与服务器的连接失败.(file:///android_asset/www/index.html)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆