ERR_CONNECTION_REFUSED Ionic 3

Hello there,

I have this problem quite a while, i traid so many things to fix this like:

  1. Downgrading cordova-plugin-ionic-webview (LINK :net::ERR_CONNECTION_REFUSED (http://localhost:8080/) <–> Android Problem: net::ERR_CONNECTION_REFUSED (http://localhost:8080/) <–> https://ionic.zone/debug/ionic-and-android-4

  2. Change config.xml (LINK: Problem: net::ERR_CONNECTION_REFUSED on debug apk)

the app only work with the comand ionic cordova run android -l if i try to --released or just run the app shows the erro!

Comand List :
ionic cordova run android -l (WORK)
ionic cordova run android (Don’t Work)
ionic cordova run android --released (Don’t Work)
ionic cordova run android --released --prod (Don’t Work)
ionic cordova run android --prod (Don’t Work)

Untitled|247x499

Ionic Info:

Ionic:

   Ionic CLI          : 5.2.8 (C:\Users\tm_ma\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 4.1.1, (and 21 other plugins)

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.8

System:

   Android SDK Tools : 26.1.1 (C:\Users\tm_ma\AppData\Local\Android\Sdk)
   NodeJS            : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10

Config.xml

<name>Kiddo</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="hi@ionicframework" href="http://ionicframework.com/">DS</author>
    <content src="http://localhost:8100" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
        <application android:usesCleartextTraffic="true" />
    </edit-config>
    <resource-file src="resources/android/xml/network_security_config.xml" target="res/xml/network_security_config.xml" />
    <allow-navigation href="*" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    <preference name="AutoHideSplashScreen" value="false" />
    <preference name="loadUrlTimeoutValue" value="700000" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
    </platform>
    <plugin name="cordova-plugin-whitelist" spec="~1.3.3" />
    <plugin name="cordova-plugin-device" spec="~2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="~5.0.2" />
    <plugin name="cordova-plugin-nativestorage" spec="~2.3.2" />
    <plugin name="cordova-plugin-file" spec="^6.0.1" />
    <plugin name="phonegap-plugin-barcodescanner" spec="~8.0.0">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-android-permissions" spec="~1.0.0" />
    <plugin name="cordova-plugin-datepicker" spec="~0.9.3" />
    <plugin name="cordova-plugin-file-transfer" spec="~1.7.1" />
    <plugin name="cordova-plugin-camera" spec="~4.0.3" />
    <plugin name="cordova-plugin-photo-library" spec="~2.2.1" />
    <plugin name="cordova-android-support-gradle-release" spec="^3.0.1" />
    <plugin name="cordova-plugin-firebasex" spec="~6.1.0">
        <variable name="FIREBASE_ANALYTICS_COLLECTION_ENABLED" value="true" />
        <variable name="FIREBASE_PERFORMANCE_COLLECTION_ENABLED" value="true" />
        <variable name="FIREBASE_CRASHLYTICS_COLLECTION_ENABLED" value="true" />
        <variable name="ANDROID_ICON_ACCENT" value="#FF00FFFF" />
        <variable name="ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION" value="17.0.0" />
        <variable name="ANDROID_FIREBASE_CORE_VERSION" value="17.0.0" />
        <variable name="ANDROID_FIREBASE_MESSAGING_VERSION" value="19.0.0" />
        <variable name="ANDROID_FIREBASE_CONFIG_VERSION" value="18.0.0" />
        <variable name="ANDROID_FIREBASE_PERF_VERSION" value="18.0.0" />
        <variable name="ANDROID_FIREBASE_AUTH_VERSION" value="18.0.0" />
        <variable name="ANDROID_CRASHLYTICS_VERSION" value="2.10.1" />
        <variable name="ANDROID_CRASHLYTICS_NDK_VERSION" value="2.1.0" />
        <variable name="ANDROID_SHORTCUTBADGER_VERSION" value="1.1.22" />
    </plugin>
    <plugin name="cordova-plugin-add-swift-support" spec="~2.0.2" />
    <plugin name="cordova-plugin-screen-orientation" spec="~3.0.2" />
    <plugin name="cordova-wheel-selector-plugin" spec="~1.0.0" />
    <plugin name="cordova-plugin-telerik-imagepicker" spec="~2.3.3">
        <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="Selecione a sua foto para enviar" />
    </plugin>
    <plugin name="cordova-plugin-advanced-http" spec="~2.1.1" />
    <plugin name="cordova-plugin-secure-storage" spec="~3.0.2" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="~2.0.5" />

Plugin List :

cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-advanced-http 2.1.1 "Advanced HTTP plugin"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-firebasex 6.1.0 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-photo-library 2.2.1 "Photo Library"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-secure-storage 3.0.2 "SecureStorage"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-telerik-imagepicker 2.3.3 "ImagePicker"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-wheel-selector-plugin 1.0.0 "Cordova Wheel Selector Plugin"
es6-promise-plugin 4.2.2 "Promise"
phonegap-plugin-barcodescanner 8.0.0 "BarcodeScanner"```

Remove your folder node_modules and reinstall using the npm install

Try it!

Thanks for the awnser, but doesnt work, the erro still appears.

I’m having the same problem. Did you ever get this working?

Same problem here, any solution?

Problem is still there :frowning:

I face this problem. You should remove the old apk installed on your device then run ionic cordova run android --device --l