Cordova: how to fix error: The connection to the server was unsuccessful. (file:///android_assets/www/index.html)


how to fix error: The connection to the server was unsuccessful. (file:///android_assets/www/index.html) ???

The connection to the server was unsuccessful

There are three methods:

Method 1:

open file config.xml and add this line:

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

loadUrlTimeoutValue

Rebuild app, now success.

Method 2:

open file config.xml and add these lines

<allow-navigation href="*" />
<content original-src="index.html" />

cordova fix error method 2

Method 3:

3.1 Rename your index.html to “main.html”
3.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.3 Rebuild your app! No more errors!

Leave a Reply