net::ERR_CONNECTION_REFUSED (http://localhost:8080/)

Hello,

I face the same problem with some devices having Android 4.4.2. My ionic info is:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.11
Cordova Platforms  : android 7.1.1 browser 5.0.3 ios 4.5.5
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.5
ios-deploy        : 1.9.2 
Node              : v8.11.2
npm               : 5.6.0 
OS                : macOS High Sierra
Xcode             : Xcode 9.4.1 Build version 9F2000 

Environment Variables:

ANDROID_HOME : /usr/local/Cellar/android-sdk/24.1.2/

Misc:

backend : pro

Define “problem” please. Where do you get this error message? Can you post a screenshot?

What command did you use to build and run the app?

Just ionic cordova build android --prod --release

It seems it only happens with devices having Android 4.4

Here is another feedback I received today

Same problem without --prod --release?

Could you create a pure Cordova project with cordova create, add the same cordova-android as in your project, and then build/run it via cordova build android?

Hello, yes I confirm, same problem without --prod --release

Thanks for your help but the problem is the new version of cordova-plugin-ionic-webview 2.0 which breaks the compatibility with Android 4.4… I found the solution on another thread:

1 Like

I have a problem net::ERR_CONNECTION_REFUSED

ty bro I solved my problem :heart_eyes::heart_eyes:

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

2 Likes

This error is fixed in the latest release 2.1.4…

ionic cordova plugin rm cordova-plugin-ionic-webview
ionic cordova platforms remove android
cordova plugin add cordova-plugin-ionic-webview
npm install @ionic-native/ionic-webview

…includes a fix for the webview in KitKat.

4 Likes

thanks for sharing! worked for me, too.

Really @IonicGeoff? https://github.com/ionic-team/cordova-plugin-ionic-webview/blob/master/CHANGELOG.md#220-pending only mentions it for an upcoming 2.2.0 release.

Works for me!

It seems to have implemented the changes made here…

Not really, the PR in the changelog is this: https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/172/files

actually i forget to call ionic cordova build android. I get this error ionic cordova platform add android then send to my phone without run build command. Cause there are no files under the www folder. Be sure, you are have got files under the www files.

I had the same issue.

In the browser (ionic serve) everything was fine, but the same error with the emulator and real device.

It was a problem with the server dev/smartphone.

I launch the app with livereload and everything works fine.

ionic cordova run android --livereload

1 Like

@MarcoMarco You command is wrong ‘–livereaload’ it must be livereload…

1 Like

@Ionic Team: I also have that issue, none of the solitions above worked. It happens in the emulator and on the real device. It’s really time consuming…Can you provide a solution, that works for all???

hi i am also facing same issue
import { HttpClient } from ‘@angular/common/http’;
this.http.get(url).subscribe((response) => {
this.appointment_types=response;
});
i am getting result in browser but not getting response in real device in android
please provide a solution i am using ionic 4 i am getting error like
zone.js:3243 GET http://localhost:8100/sockjs-node/info?t=1559937025579 net::ERR_CONNECTION_REFUSED