应用程序错误 - 到服务器的连接失败。 (文件:///android_asset/www/index.html)应用程序、错误、服务器、文件

2023-09-12 02:47:51 作者:微微一笑很倾城

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

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

我在使用的PhoneGap构建我正在写一个Android应用程序。该应用程序工作正常较早,但现在看来,IAM炼我的应用程序后,收到此错误(一些UI 0nly变化)

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

1)当我启动应用程序我(通常情况下)获得:

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

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

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

抱歉,如果这是任何问题重复。我已经看到了一些类似的问题在这里,但我could'nt找到一个完美的答案或解决方案。正如我的情况下,它是工作的罚款,直到我最后的修改。

Sorry if this is duplication of any question. I have seen some similar questions here, but i could'nt find a perfect answer or solution. As in my case it was working fine till 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

如您需要添加 super.setIntegerProperty(loadUrlTimeoutValue,70000); 在activity.java文件(在SRC / COM / yourProj / - / youractivity的.java) 上面这行: super.loadUrl(文件:///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");

说明:

此可发生由于下列原因

的核心原因:这个问题可能是由于仿真器的速度,使网络速度太慢完成及时的通信

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.

这可能是由于:

您$​​ C $ C /数据/图片太多大小(我在你的情况下猜你使用的是一些图片,因为你说你做了一些UI修改,可能是图像的大小为高) 您的脚本可能具有无限或长期循环,所以它需要太多的时间来加载。 您将使用过多的脚本(jQuery的,iscroll,等等等等。更大量的插件或脚本)