'Connection to the server was unsuccessful' error when launching phonegap app on android emulator

て烟熏妆下的殇ゞ 提交于 2020-01-12 04:52:33

问题


I am using PhoneGap to build an Android application, the application is a combination of phonegap + jquery mobile.

The application successfully launches in the emulator and I was able to debug the application, until yesterday.

Today the application just refuses to launch on the emulator, and I keep getting this error

06-25 09:03:24.453: INFO/System.out(305): onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///android_asset/www/index.html

回答1:


This seems to be a phonegap 0.9.3 issue, as other people have reported the same problem (see here or here)

The problem might be solved by changing the loadUrlTimeoutValue

this.setIntegerProperty("loadUrlTimeoutValue", 70000);



回答2:


Use bigger value then 60sec, emulator can be extremely slow.

super.setIntegerProperty("loadUrlTimeoutValue", 360000);

and you can refer this also.. Check this!




回答3:


I have solved this by adding

super.setIntegerProperty("loadUrlTimeoutValue", 10000);  

to the com.mypackage.xxx.java file for 10 sec waiting time.ie,

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.loadUrl("file:///android_asset/www/home/index.html");
    super.setIntegerProperty("loadUrlTimeoutValue", 10000); 


来源:https://stackoverflow.com/questions/6477798/connection-to-the-server-was-unsuccessful-error-when-launching-phonegap-app-on

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!