I've added material icons to ionic2 app , and since then I get error ""The connection to the server was unsuccessful. (file:///android_asset/www/index.html)"" although the css and fonts file of MaterialIcons are in the assets folder (I've install it locally) there is no call to "https://fonts.googleapis.com/icon?family=Material+Icons" what can I do ? Can I fix it or know why the timeout suddenly .
-
I also have this error using another framework (Quasar/Vue) and build a production app for Android. On my Samsung A41 this problem does not occur, but does occur on my Samsung A3 – A.W. Mar 30 '21 at 09:07
8 Answers
Add <preference name="loadUrlTimeoutValue" value="60000" />
To config.xml

- 3,477
- 8
- 37
- 59
-
Worked but i had to top the value to 100000, guess this phone is too old for this sh*t! – konzo Aug 25 '17 at 06:34
-
2
-
2before using that solution make sure you first try solution here https://stackoverflow.com/a/48105757/448816 (use `--prod` flag when building project) – mikhail-t Oct 12 '18 at 21:46
-
-
https://onezeronull.com/2013/08/09/increasing-loadurltimeoutvalue-to-avoid-connection-to-server-was-unsuccessful-error/ check this @SlimaneMEHARZI – buggy_coder Jul 23 '21 at 15:06
Adding that ...value="70000" or "60000" line in config.xml isn't the best solution and it doesn't always work nor the creation of main.html file .
I was dealing with the same issue. These two solutions did not work for me.
SOLUTION
-Make sure you build with
ionic cordova build --prod and not ionic cordova build
-Check if one of your file or folder name doesn't contain Uppercase in it's context before building
like for example in "pages"
templateView (instead of "templateview)
- -templateview.ts
- -templateview.html
- -templateview.scss
and rename it (otherwise you will have errors)
When building finished, your app runs correctly without the "(file:///android_asset/www/index.html)" error.

- 191
- 1
- 7
As of now above solutions will work but the app will take time to load, instead of that you can simply add below in your MainActivity.java super.loadUrl("file:///android_asset/www/index.html");
In MainActivity.java you have to comment below code loadUrl(launchUrl);
public class MainActivity extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// enable Cordova apps to be started in the background
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
moveTaskToBack(true);
}
// Set by <content src="index.html" /> in config.xml
//loadUrl(launchUrl);
super.loadUrl("file:///android_asset/www/index.html");
}
}

- 41
- 2
Just need to also make sure that your mobile device is connected to the same wifi as your computer.

- 3,897
- 3
- 22
- 28
Please check your device version ionic not properly work on android < 4.4.4 version you could try this above 4 version if you want to work with 4.* version you could install cordova-crosswalk plugin

- 406
- 9
- 18
So I added manually the following tags in config.xml right at the beginning:
<allow-navigation href="*" />
<content src=“index.html” />
<content original-src=“index.html” />
it’s working.

- 412
- 3
- 9
1- Rename your index.html to “main.html”
2- Create a new “index.html” and put the following content into it:
<!doctype html>
<html>
<head>
<title>tittle</title>
<script>
window.location='./main.html';
</script>
<body>
</body>
</html>
3- Rebuild your app! No more errors!

- 6,834
- 9
- 49
- 79

- 31
- 1
-
OMG what you want to achieve here? Where `main.html` is defined that it will be the first to load instead of `index.html` – fWd82 May 03 '17 at 09:43
-
3
-
It is not working .!!!!. Application Error. FILE_NOT_FOUND Error occurs. ? – Dr. X Aug 27 '17 at 13:34
-
whats the point change one html page to another? it's just url that picked up in MainActivity.java! – Konstantin Jul 31 '23 at 08:53
I add plugin:
cordova plugin add cordova-plugin-crosswalk-webview
then,
ionic cordova platform rm android
ionic cordova platform add android
ionic cordova build android (or Run)

- 10,003
- 10
- 39
- 90
-
1This doesn't seem like an answer. Can you provide some more details ? – The Hungry Dictator Jun 28 '17 at 05:28