Application Error The connection to the server was unsuccessful
When I run my application on 'ionic serve' everything works, but when I testing my apk(https://ionicframework.com/docs/guide/publishing.html) on a smartphone, I'm getting this:
"Application Error The connection to the server was unsuccessful (file:///android_asset/www/index.html)"
Ionic version: (check one with "x") [ ] 1.x [x ] 2.x
I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
Expected behavior:
Steps to reproduce:
Related code:
insert any relevant code here
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
insert the output from ionic info here
Add
<preference name="loadUrlTimeoutValue" value="700000" />
in your config.xml file.
Thanks!
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!
here is my ionic info but still getting same problem
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.1.0
Ionic Framework : ionic-angular 3.2.1
I had the same problem and solved it disabling my computer firewall
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.
Nothing of tha works for me
same here =(
in www folder having index.html page and src folder having index.html page ok i change twopages rename as main.html and i add the and next i run in ionic serve --lab its not working for me. its just showing hide message can you please help me
Hi guys. I had the same problem.
And the perfect solution for me was:
running the command with --prod.
ionic cordova run android --prod
or
ionic cordova build android --prod
Now it's work for me like a magic. I hope that will help you too
Mine ended up being the firewall issue. Thanks @GeoSaboti!!!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.