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
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");
}
}
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
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)
Just need to also make sure that your mobile device is connected to the same wifi as your computer.
Add <preference name="loadUrlTimeoutValue" value="60000" />
To config.xml
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!