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

后端 未结 16 1772
小蘑菇
小蘑菇 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:02

    I had a similar issue and based on above suggestions I first added "super.setIntegerProperty("loadUrlTimeoutValue", 70000);" but that did not help. So I tried Project -> Clean, that worked and I can launch the app now !

    Avinash...

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

    Here is the working solution

    create a new page main.html

    example:

    <!doctype html>
    <html>
      <head>
       <title>tittle</title>
       <script>
         window.location='./index.html';
       </script>
      </head>
      <body>
      </body>
    </html>
    

    change the following in mainactivity.java

    super.loadUrl("file:///android_asset/www/index.html");
    

    to

    super.loadUrl("file:///android_asset/www/main.html");
    

    Now build your application and it works on any slow connection

    refernce.

    NOTE: This is a workaround I found in 2013.

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

    Please remove remotely linked jQuery files such as: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

    Instead, download this file and load it from your local js folder, making the URI:

    js/jquery.min.js

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

    Try this,

    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!

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

    I had the same on my project.

    I tried " super.setIntegerProperty("loadUrlTimeoutValue", 70000); " but to no avail.

    I ensured all files were linked properly [ CSS, JS files etc ], validated the HTML using w3c validator [ http://validator.w3.org/#validate_by_upload ] , and cleaned the project [ Project -> Clean ]

    It now loads and executes without the same error.

    Hope this helps

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

    In my case I am using ionic and I simply closed the dialog went to apps in the emulator and ran my app from there instead. This worked. I got the idea of that from here since it was just a time out issue.

    0 讨论(0)
提交回复
热议问题