ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Application Error The connection to the server was unsuccessful

Open Giuan0 opened this issue 10 years ago • 12 comments

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

Giuan0 avatar Nov 21 '16 00:11 Giuan0

Add

<preference name="loadUrlTimeoutValue" value="700000" />

in your config.xml file.

infinnie avatar Nov 21 '16 07:11 infinnie

Thanks!

Giuan0 avatar Nov 21 '16 11:11 Giuan0

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!

source

almgwary avatar May 18 '17 09:05 almgwary

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

EmmanuelNocks avatar Jul 26 '17 08:07 EmmanuelNocks

I had the same problem and solved it disabling my computer firewall

GeoSaboti avatar Aug 06 '17 23:08 GeoSaboti

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.

MRUNetwork avatar Oct 18 '17 21:10 MRUNetwork

Nothing of tha works for me

matedemorphy avatar Nov 28 '17 22:11 matedemorphy

same here =(

luanrodrigues avatar Dec 16 '17 19:12 luanrodrigues

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

orengbasha avatar Feb 14 '18 07:02 orengbasha

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

nabilzidane avatar Mar 05 '18 01:03 nabilzidane

Mine ended up being the firewall issue. Thanks @GeoSaboti!!!

srobins259 avatar Jun 25 '18 20:06 srobins259

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.

ionitron-bot[bot] avatar Sep 01 '18 03:09 ionitron-bot[bot]