Problem: net::ERR_CONNECTION_REFUSED on debug apk

Hi,

while testing the app i came across the problem that i can only run the app if ionic serve is running.
The case is that i wanted to make the app so that it runs without ionic serve or any serve for that matter.

are there perhaps any wrongs in my config.xml?

i thought that after building, you can run it without the use of ionic serve.

if i run the app without ionic serve turned on i get the error net::ERR_CONNECTION_REFUSED (http://localhost/)

behind this error there is an error which is ERR_FILE_NOT_FOUND(file:///android_asset/www/index.html)

android version is 7.1.2(it uses the custom rom from lineage os)

Can try adding the below values in your config.xml

<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” />

Excuses for the late response. I didn’t have the laptop which had the project.

my Config.xml looks is as follows.

<name>Project foo</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
    <content src="www" />
    <access origin="*" />
    <allow-navigation href="http://localhost:8080/*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="19" />
    <preference name="BackupWebStorage" value="none" />
    <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" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-device" spec="2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <allow-navigation href="http://localhost/" />
    <engine name="android" spec="7.1.4" />

There are some Ios and Android splashes in the middle as well, but i don’t think they matter in this scenario

EDIT:
After adding the other preferences i dont get net:ERR_connection_refused.
Instead the only error i get is FILE_NOT_FOUND

problem has been solved.

<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>TriStar</name>
    <description>An awesome Ionic/Cordova app.</description>
    <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
    <content src="index.html" /> //changed from www to index.html
    <access origin="*" />
    <allow-navigation href="http://localhost:8080/*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="19" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="AutoHideSplashScreen" value="false" />
    <preference name="loadUrlTimeoutValue" value="700000" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-device" spec="2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <allow-navigation href="localhost:8080/*" />  // changed this into :8080
    <allow-navigation href="https://foo.bar/api/index.php" />
    <engine name="android" spec="7.1.4" />
3 Likes

The error connection that occurs with the following part which will be going to manage it according to the part so it will be able https://netgears.support/blog/netgear-r6700-nighthawk-ac1750-review/ to provide the best way to identify the debug apk…

@B3nvo, it’s unfortunate that you don’t say what your solution was. Did you add something to your config.xml which fixed this for you?

Same dude here, what is the solution?

trying making any calls to external URLs as https rather than http.

All are https… :frowning: It’s not the problem

I fixed the issue by adding the api url into

For me that was all that was necessary. Others might have different problems.

Just need to add

it’s adding by default

 <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />

@NurGuz are you trying to debug the app?
Because intent and navigation is for something not related to this.

Yes, ofc. With --livereload works perfect.

I use this command when I debug, please check if this is helpful for you.
Ionic cordova run android -lc – -d

1 Like

Hai @NurGuz, Did you got any workaround for this issue? If yes please let me know. Thanks

this is the correct in the config.xml:

<content src="index.html" />