Android ERR_CONNECTION_REFUSED when running

Hi - I am running an ionic 4 app and need to change my server url to a local ip address in order for a widget to work (intercom requires app to be run on ip address rather than localhost).

So, I added the following to my capacitor.config.json.

  "server": {
    "url": ""

This works for iOS (when I use capacitor:// but for android (on the emulator), I get ERR_CONNECTION_REFUSED when loading the app.

Any help would be greatly appreciated. Have tried adding the below to my config.xml but that did not work.

<allow-navigation href="*"/>

Instead of setting the “url”, set the “hostname” to “”

@jcesarmobile this works great! thank you!

do you know if there is any way to make these specific per platform? seems like ios needs url to be while android needs url to be

I know I can change these manually on each platform, but would prefer to use something built in if possible. I tried adding the platform specific server under “ios” and “android” properties but that did not read them in at all.

Thanks for your help!

It’s not possible, but what you say sounds very weird.
By setting the hostname to “” the app should load capacitor:// for iOS and for Android.

1 Like

@jcesarmobile you’re right - works to just have the hostname set to for both ios and android.

Thanks so much!

Thank you so much! This works for me!