Tip for anyone building HTML 5 apps using PhoneGap (now called Cordova). If you are seeing inconsistent/transient error messages saying something like [Connection to server was unsuccessful to “www/assets/index.html”] when starting up your app. This is caused by your App timing out. You can either increase the time-out time, but will only reduce the frequency of the issue, or you can:

  1. Rename your index.html to “main.html”
  2. Create a new “index.html” and put the following content into it:
    <!doctype html>
  3. Rebuild your app! No more errors!

Another good idea is to give your application a “splash screen”, so that the user gets instant feedback that your app is loading/working, before it is fully ready.

56 Comments » for Fix for PhoneGap: Connection to server was unsuccessful
  1. Robin says:

    Thanq so much.. it works fine

  2. Pablo says:

    Great! it works!. Thank you very much. It saved my day!. Sorry for the spam comment, but i was a long time looking for this.

  3. Um says:

    excellent suggestion. it was quite annoying to see this error frequently

  4. Ansad says:

    Thanks dear… Its working for me in Android 4.0. You saved mylife too…

  5. raxy says:

    Great, I confirm it solved my issue as expected.
    But I would like to know if this does not just move the problemn elswhere….
    Slow response is the real issue, and I still suffer from that in other areas of the application.

  6. Omama says:

    wow, this solution,works out for me….yahoo

  7. Ashok Parmar says:

    Thanks for given idea.

  8. Luis says:

    Excellent, it work fine now, tanks

  9. vogdb says:

    Thank you so much for this solution!

  10. i-keng says:

    Thanks it’s work for me..^^

  11. Pedro Luiz says:

    Thanks, Works Fine!

  12. Gonzalo says:

    ok, it works… But now I can’t use the debug. The debugger doesn’t work since this change and I have an $.ajax function with problems

    • Robert says:

      Which debugger are you talking about? Are you able to replicate the issue without using PhoneGap? What device are you using?

  13. Jehoshaph Akshay says:

    Thanks a lot. By the way, I think this is only an issue with the emulator because the application works fine on a real device.

    • Robert says:

      Glad it helps. I imagine the reason it works on your real device is because it is “faster” than the emulator. You should test on older/slower devices as the timeout problem is likely to reappear.

  14. Raviraj Kakade says:

    Nice..dude..it work fine

  15. Raviraj Kakade says:

    nice..it work fine

  16. Amit Kumar Swami says:

    Great..Solution, Really Worked.

  17. Tom says:

    Thank you very much!

  18. manoj says:

    thank you very much….for such info

  19. Arham says:

    Very nice …
    Great..Solution, Really Worked , it work fine

  20. adi sukawana says:

    thanks you so much..it worked

  21. Vitthal says:

    Thanks a lot for your solution.
    It worked for me.

  22. Bas says:

    this worked for me too, however i’m curious how to increase the time-out time. Is that configurable within the phone gap config.xml or an option within Android…?

  23. Matty Kane says:

    Worked like a charm, especially since “setIntegerProperty” is deprecated. Appreciate it a lot dude…you rock!

  24. sachin shetty says:

    Awesome dude :). Good work

  25. pavithra says:


  26. Malvika says:

    Thank you

  27. Dharmendra says:

    This is caused only by your Application time-out time. Just increase its time-out duration,in your application add the below line to the java class before before you are loading your app url.

    super.setIntegerProperty(“loadUrlTimeoutValue”, 60000);

  28. Amy Chang says:

    Good! Thank you ~ ^U^

  29. Michael Bredbury says:

    I had the same error but the solution for me was that I had to rename my Index.html to index.html (remove the upper case ‘I’). Wasted many an hour on this! Your solution did work as well, but then that was because I created a new page all lower-case named iindex.html ! All good fun! Many thanks.

  30. Vaidehi says:

    Thanks!!! It’s working for me.

  31. TRESHA Mcfadden says:

    This fixed my problem thank you so much.

  32. YUGENDHAR says:

    Thanks…:) It’s working for me…great post!!!!!!!!!!!!

  33. kalpesh says:

    Thank you so much

  34. Bino says:

    Cool, it worked for me too.

  35. erik says:

    Thanks you for the help.

  36. Working for me, many thanks

  37. vGttt says:

    Nice, it works.

  38. Jordi says:

    Totally worked for me, many thanks!

  39. Marcelo Ribeiro says:

    Working for me, thanks

  40. Philips says:

    This is one solution to this problem, it works perfectly for me

  41. Dimas says:

    Great!!!! Works perfect!

  42. sarfaraz says:

    That Helps

  43. damo says:

    It working thanks

  44. Christ_ducy says:

    thanks,it solved my problem!

  45. Jermaine McFarlane says:

    Thanks worked for me too

  46. shgz says:

    3 years ago still helps thank you!

  47. Lesmana says:

    Thanks bro

  48. Olanrewaju Collins says:

    Dude, You are the best

  49. Victor says:

    Muy bien, funcionó.
    Muchas gracias!


    This solution has worked for me too. Thanks very much!

1 Pings/Trackbacks for "Fix for PhoneGap: Connection to server was unsuccessful"

Leave a Reply

Your email address will not be published. Required fields are marked *