Caroline
Caroline

Reputation: 61

Connection to the server was unsuccessful. (file ///android_asset/www/index.html)

I have an error when I run my app on ionic cordova run android. My error is : Connection to the server was unsuccessful. (file ///android_asset/www/index.html) I try to resolve it with forums that exists with this solution :

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>title</title>
   <script>
     window.location='./main.html';
   </script>
  <body>
  </body>
</html> 

Or modify in the config.xml this line :

<preference name="SplashScreenDelay" value="3000" />

to this line :

<preference name="SplashScreenDelay" value="70000" />

But when I run my app after saving my new code, the error still appear and when I return into my code, I see that the code is still the same and not has been modified (even if I modified it like I sayed previously !)

Someone know how to resolve my problem ?

Thanks in advance, Caroline

Upvotes: 3

Views: 6496

Answers (4)

Tomislav Stankovic
Tomislav Stankovic

Reputation: 3128

I had that error with one application and I solved it with Crosswalk.

ionic plugin add cordova-plugin-crosswalk-webview

After installation you may have to adjust the design but the error will no longer appear.


Optional config.xml settings:

<preference name="loadUrlTimeoutValue" value="60000" />
<preference name="AutoHideSplashScreen" value="false" />

Upvotes: 1

Caroline
Caroline

Reputation: 61

It's not really an answer but it allowed me to see my app without the error message.

When I run my app with the terminal ionic cordova run android the error still persist.

But if I run my app with Android Studio it's works !

Upvotes: 0

Vivek Kasture
Vivek Kasture

Reputation: 329

Add and Remove android platform ionic platform rm android ionic platform add android

Upvotes: 0

maninak
maninak

Reputation: 2726

Try updating your Cordova android platform:

ionic platform remove android
ionic platform add android

Upvotes: 0

Related Questions