# Android Debug Build Fails

**URL:** <https://forum.ionicframework.com/t/android-debug-build-fails/138781>\
**Category:** ionic-v3\
**Created:** [August 17, 2018, 2:47pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781 "2018-08-17T14:47:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![neilsherman](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@neilsherman](https://forum.ionicframework.com/u/neilsherman)\
**Post date:** [August 17, 2018, 2:47pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/1 "2018-08-17T14:47:17Z")

</div>

When building a new Ionic app and deploying the APK to an Android device the app fails to start with the error message:

ERR\_CONNECTION\_REFUSED ([http://localhost:8080](http://localhost:8080))

I can replicate this issue with the following steps:

1. ionic start test blank
2. ionic cordova build android
3. Deploy the debug APK to the Android device
4. Open the application

Ionic info:

Ionic:

ionic (Ionic CLI) : 4.1.0 (/usr/local/lib/node\_modules/ionic)  
Ionic Framework : ionic-angular 3.9.2  
@ionic/app-scripts : 3.1.11

Cordova:

cordova (Cordova CLI) : 8.0.0  
Cordova Platforms : android 7.0.0  
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 4 other plugins)

System:

ios-sim : 5.0.13  
NodeJS : v8.9.3 (/usr/local/bin/node)  
npm : 6.2.0  
OS : macOS High Sierra  
Xcode : Xcode 9.2 Build version 9C40b

Environment:

ANDROID\_HOME : not set

---

<div class="post-metadata">

**Author:** ![neilsherman](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@neilsherman](https://forum.ionicframework.com/u/neilsherman)\
**Post date:** [August 17, 2018, 5:29pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/2 "2018-08-17T17:29:52Z")

</div>

This appears to be related to the version of Android. Running the app on an Android device with 4.2 fails with the above error, yet running the same app on a newer version of Android works fine.

Unfortunately I need to target an older Android version. I have tried downgrading the version of cordova-android but with little success.

Anything else I should be looking at?

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 17, 2018, 9:29pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/3 "2018-08-17T21:29:25Z")

</div>

This is caused by:

> [@neilsherman](#):
>
> cordova-plugin-ionic-webview 2.0.3

2.x of this plugin only supports Android 5.x and newer. You will have to use an older version.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [August 17, 2018, 11:05pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/4 "2018-08-17T23:05:28Z")

</div>

AFAIK, no Ionic version past v1 supports Android \<4.4.

---

<div class="post-metadata">

**Author:** ![neilsherman](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@neilsherman](https://forum.ionicframework.com/u/neilsherman)\
**Post date:** [August 18, 2018, 10:29am UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/5 "2018-08-18T10:29:30Z")

</div>

> [@Sujan12](#):
>
> cordova-plugin-ionic-webview

Awesome, downgrading cordova-plugin-ionic-webview fixed the issue - many thanks

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 25, 2018, 1:05pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/6 "2018-08-25T13:05:17Z")

</div>

For future readers of this topic:

If the device you are testing on is using Android 4.x (e.g. Android 4.4 KitKat), this article might explain what is going on and how to fix it: [https://ionic.zone/debug/ionic-and-android-4](https://ionic.zone/debug/ionic-and-android-4)

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:23pm UTC](https://forum.ionicframework.com/t/android-debug-build-fails/138781/7 "2021-07-19T21:23:05Z")

</div>

Closed on July 19, 2021, 9:23pm UTC


