Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)
In your config.xml file add this line:
<preference name="loadUrlTimeoutValue" value="700000" />
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:
- 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)
- Your script may have a infinite or long loop, so that it takes too much of time to load.
- You will be using too much of scripts (jQuery, iscroll, etc etc.. more number of plugins or scripts )
Here is the working solution
create a new page main.html
example:
<!doctype html>
<html>
<head>
<title>tittle</title>
<script>
window.location='./index.html';
</script>
</head>
<body>
</body>
</html>
change the following in mainactivity.java
super.loadUrl("file:///android_asset/www/index.html");
to
super.loadUrl("file:///android_asset/www/main.html");
Now build your application and it works on any slow connection
refernce.
NOTE: This is a workaround I found in 2013.