# Application error. The connection to the server was unsuccessful

**URL:** <https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584>\
**Category:** ionic-v1\
**Created:** [October 20, 2016, 8:02am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584 "2016-10-20T08:02:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierro](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pierro](https://forum.ionicframework.com/u/pierro)\
**Post date:** [October 20, 2016, 8:02am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/1 "2016-10-20T08:02:29Z")

</div>

Yet again this problem, I know.  
Launching the app on android gives an “application error. The connection to the server was unsuccessful”.

Many topics on this subjects, all pointing out to potential js or css using external link.  
However, I have absolutely no file using external link in my code, and mostly not in my index.html

The strangest part is that this problem **suddenly** happened to all my android users last night for no reason at all. The same build that has been working for weeks sudddenly got this error on every android device. This morning, everything fell into place again. However, I do not want that to ever happen again.

This whole thing just seem so random, how could it happen like that on every device without even needing a database connexion at that point ?

Please anyone, enlighten me.

---

<div class="post-metadata">

**Author:** ![maruti](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/maruti/32/103634_2.png) [@maruti](https://forum.ionicframework.com/u/maruti)\
**Post date:** [October 24, 2016, 7:05am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/2 "2016-10-24T07:05:23Z")

</div>

Any solution for this? I am stuck with this issue. can anyone from ionic team help here?  
@mhartington

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/2/4/2478f8535c3d8913e07411708597611fb67b047d.png)

I am running out of time to deliver just because of this issue 😑

Device is running on 4.4.4, ionic info is below

```
Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.36
ios-deploy version: 1.8.6 
ios-sim version: 5.0.8 
OS: Mac OS X Sierra
Node Version: v4.6.0
Xcode version: Xcode 8.0 Build version 8A218a
```

---

<div class="post-metadata">

**Author:** ![pierro](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pierro](https://forum.ionicframework.com/u/pierro)\
**Post date:** [October 24, 2016, 7:21am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/3 "2016-10-24T07:21:22Z")

</div>

Although I find this method infinitely ugly, I found it online and it might be working in your case:

[https://www.robertkehoe.com/2013/01/fix-for-phonegap-connection-to-server-was-unsuccessful/](https://www.robertkehoe.com/2013/01/fix-for-phonegap-connection-to-server-was-unsuccessful/)

However, I really hope we can find a cleaner solution to this problem.  
And on top of it, I would love an explanation why it happened to me in a production app that was working fine for weeks.

---

<div class="post-metadata">

**Author:** ![maruti](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/maruti/32/103634_2.png) [@maruti](https://forum.ionicframework.com/u/maruti)\
**Post date:** [October 24, 2016, 7:51am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/4 "2016-10-24T07:51:01Z")

</div>

Thanks @pierro, Actually the issue is only with android 4.4.4 devices. In other mobiles it works!

---

<div class="post-metadata">

**Author:** ![maruti](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/maruti/32/103634_2.png) [@maruti](https://forum.ionicframework.com/u/maruti)\
**Post date:** [October 24, 2016, 9:09am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/5 "2016-10-24T09:09:16Z")

</div>

I found some solution for this, but this is not the optimal solution

[https://forum.ionicframework.com/t/app-error-and-cordova-deviceready-not-fired/50996](https://forum.ionicframework.com/t/app-error-and-cordova-deviceready-not-fired/50996)

---

<div class="post-metadata">

**Author:** ![pierro](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pierro](https://forum.ionicframework.com/u/pierro)\
**Post date:** [October 24, 2016, 9:32am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/6 "2016-10-24T09:32:50Z")

</div>

I don’t like it either.

This is not really a solution, it will just delay the error.  
Instead of popping up right away, it will wait for 70seconds to pop up. Still bad. 😕

---

<div class="post-metadata">

**Author:** ![fredDS](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@fredDS](https://forum.ionicframework.com/u/fredDS)\
**Post date:** [December 25, 2016, 7:54pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/7 "2016-12-25T19:54:37Z")

</div>

Add the next line into the config.xml in side the tag.

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

---

<div class="post-metadata">

**Author:** ![saurabhgupta0508](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/saurabhgupta0508/32/103188_2.png) [@saurabhgupta0508](https://forum.ionicframework.com/u/saurabhgupta0508)\
**Post date:** [December 26, 2016, 7:18am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/8 "2016-12-26T07:18:27Z")

</div>

I once had similar problem when I used a `:` in an img tag. I was using angular’s one time binding. Replacing img with ng-img resolved my problem. Hope this helps

---

<div class="post-metadata">

**Author:** ![caldweca](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/caldweca/32/107622_2.png) [@caldweca](https://forum.ionicframework.com/u/caldweca)\
**Post date:** [March 16, 2017, 5:03pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/9 "2017-03-16T17:03:31Z")

</div>

@maruti did you find a solution to this? I’m having the same issue.

---

<div class="post-metadata">

**Author:** ![maruti](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/maruti/32/103634_2.png) [@maruti](https://forum.ionicframework.com/u/maruti)\
**Post date:** [March 20, 2017, 7:31am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/10 "2017-03-20T07:31:17Z")

</div>

As I have mentioned in my previous comment, I could resolve this code.  
Add the next line into the config.xml in side the

```
   <platform name="android"><preference name="loadUrlTimeoutValue" value="700000" />
```

---

<div class="post-metadata">

**Author:** ![mukesh\_yadav2170](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mukesh\_yadav2170](https://forum.ionicframework.com/u/mukesh_yadav2170)\
**Post date:** [March 25, 2017, 7:34am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/11 "2017-03-25T07:34:22Z")

</div>

I am also facing this problem long time finally solved this issue using

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

```

Add this to config.xml only and run that work fine.

---

<div class="post-metadata">

**Author:** ![lum3ll](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@lum3ll](https://forum.ionicframework.com/u/lum3ll)\
**Post date:** [May 1, 2017, 7:54pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/12 "2017-05-01T19:54:26Z")

</div>

Perfect solution… thanks!

---

<div class="post-metadata">

**Author:** ![shameem](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/shameem/32/131825_2.png) [@shameem](https://forum.ionicframework.com/u/shameem)\
**Post date:** [May 13, 2017, 1:04pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/13 "2017-05-13T13:04:12Z")

</div>

> [@maruti](#):
>
> \<preference name=“loadUrlTimeoutValue” value=“700000” /\>

I dont know why but for my case its probably not solving. Any other solution?

---

<div class="post-metadata">

**Author:** ![shameem](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/shameem/32/131825_2.png) [@shameem](https://forum.ionicframework.com/u/shameem)\
**Post date:** [May 13, 2017, 1:26pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/14 "2017-05-13T13:26:40Z")

</div>

Dont worry Guys, finally its works. But I had to remove android, then re-add platform.

Thanls

---

<div class="post-metadata">

**Author:** ![jsalvador](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jsalvador/32/109463_2.png) [@jsalvador](https://forum.ionicframework.com/u/jsalvador)\
**Post date:** [May 15, 2017, 8:09am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/15 "2017-05-15T08:09:07Z")

</div>

I was facing this error too.

The cause of this failure is **something that can’t be loaded by any reason**. For me, was an external script (it must be external) that was returning a 404.

Solution was fixing this 404 at the server, and adding `async defer` to script declaration.

```auto
<script async defer src="http://foo.com/scripts/bar.js></script>

```

And… fixed it!

No need to remove and add again the platform.

---

<div class="post-metadata">

**Author:** ![yajuve](https://avatars.discourse-cdn.com/v4/letter/y/2bfe46/32.png) [@yajuve](https://forum.ionicframework.com/u/yajuve)\
**Post date:** [May 25, 2017, 3:40pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/16 "2017-05-25T15:40:53Z")

</div>

Hi!  
It works for me 🙂

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

But what means value=“700000” ?  
Seconds or milliseconds ??

Thanks,

---

<div class="post-metadata">

**Author:** ![fredDS](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@fredDS](https://forum.ionicframework.com/u/fredDS)\
**Post date:** [May 26, 2017, 8:24am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/17 "2017-05-26T08:24:51Z")

</div>

According to [Cordova documentation](https://cordova.apache.org/docs/en/latest/config_ref/index.html#preference)

> LoadUrlTimeoutValue (number in milliseconds, default to 20000 =\> 20 seconds): When loading a page, the amount of time to wait before throwing a timeout error.

---

<div class="post-metadata">

**Author:** ![yajuve](https://avatars.discourse-cdn.com/v4/letter/y/2bfe46/32.png) [@yajuve](https://forum.ionicframework.com/u/yajuve)\
**Post date:** [May 28, 2017, 1:04pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/18 "2017-05-28T13:04:06Z")

</div>

> [@yajuve](#):
>
> loadUrlTimeoutValue

Thank youuu @fredDS😉

---

<div class="post-metadata">

**Author:** ![ShehramTahir](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/shehramtahir/32/110823_2.png) [@ShehramTahir](https://forum.ionicframework.com/u/ShehramTahir)\
**Post date:** [July 7, 2017, 7:34am UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/19 "2017-07-07T07:34:19Z")

</div>

`<platform name="android"><preference name="loadUrlTimeoutValue" value="700000" />`

Do we need to mention platform name as well ?

or simply `<preference name="loadUrlTimeoutValue" value="700000" />`

If I am developing a application for both iOS and android platform

---

<div class="post-metadata">

**Author:** ![fredDS](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@fredDS](https://forum.ionicframework.com/u/fredDS)\
**Post date:** [July 7, 2017, 1:07pm UTC](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584/21 "2017-07-07T13:07:35Z")

</div>

Since the error only occurs on Android platform, the first option is the best.

```auto
    <platform name="android">
        <preference name="loadUrlTimeoutValue" value="700000" />
    </platform>

```

[Next page](https://forum.ionicframework.com/t/application-error-the-connection-to-the-server-was-unsuccessful/67584.md?page=2)
