Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

后端 未结 16 1773
小蘑菇
小蘑菇 2020-11-28 01:28

App Dies On Startup (connection to the server was unsuccessful)

I have an Android application that I\'m writing using PhoneGap BUILD. The app was working fine earli

相关标签:
16条回答
  • 2020-11-28 02:12

    I was facing the same issue. I noticed that in my index i had both the "on device ready" and the "document.ready" function, so removing one of them fixed my problem :)

    0 讨论(0)
  • 2020-11-28 02:13

    Remove the external scripts in your index.html

    Change this:

    <script src="http://code.highcharts.com/highcharts-more.js"></script>
    

    to

    <script src="project_folder/highcharts-more.js"></script>
    
    0 讨论(0)
  • 2020-11-28 02:13

    Another reason this error might occur is: there is no index.html in .../YourApp/www/ !

    I just followed the ionic guide, and one of the steps is:

    $ rm www/index.html
    

    On iOS this is no problem as during the build the compiler takes some default HTML instead. However, when building for android, NO example index.html is used. Took me sometime to find out ("WHY does it work on iOS, but not on android...?)

    Easy solution: create a index.html, save it under .../YourApp/www, rebuild ...et voila!

    0 讨论(0)
  • 2020-11-28 02:17

    Check you index.html file. If you use external resources, that not available when you run application then you can get this error.

    In my case I forgot to delete link on debugger script (weinre).

    <script src="http://192.168.0.102:8080/target/target-script-min.js#anonymous"></script>
    

    So application worked on emulator because http://192.168.0.102:8080/ was on my localhost and available for emulator.

    But when I setup application on mobile phone I had same error, because 192.168.0.102 was not available from mobile network.

    0 讨论(0)
  • 2020-11-28 02:20

    For my case, the problem was due to losing of the internet connection in my WiFi.

    0 讨论(0)
  • 2020-11-28 02:22

    In your config.xml file add this line:

    <preference name="loadUrlTimeoutValue" value="700000" />
    
    0 讨论(0)
提交回复
热议问题