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

后端 未结 16 1935
小蘑菇
小蘑菇 2020-11-28 01:28

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

I have an Android application that I\'m writing using PhoneGap BUILD. The app was working fine earli

16条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 02:27

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

    The problem might be solved by adding a timeout to call your 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");

    Explanation:

    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.

    This can be due to:

    1. Your code/data/image is of too much of size ( I guess in your case you are using some images ,as you said you made some UI modifications, may be the size of images are high)
    2. Your script may have a infinite or long loop, so that it takes too much of time to load.
    3. You will be using too much of scripts (jQuery, iscroll, etc etc.. more number of plugins or scripts )

提交回复
热议问题