Android Debug Build Fails

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)

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 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 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)


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


ANDROID_HOME : not set

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?

This is caused by:

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

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

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

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: