1

My Ionic app works fine when running with ionic serve but when i use the command ionic capacitor run android -l it doesn't hit on sever and gives error

Webpage not available: net::ERR_CONNECTION_REFUSED

I am using the latest Ionic version.

capacitor.config.json

{
  "appId": "fire.app.flashlight",
  "appName": "Flashlight",
  "bundledWebRuntime": false,
  "windowsAndroidStudioPath": "C:\\Users\\Digisoft\\Downloads\\Compressed\\android-studio-ide-201.6692364-windows\\android-studio\\bin\\studio64.exe",
  "npmClient": "npm",
  "webDir": "www",
  "plugins": {
    "SplashScreen": {
      "launchShowDuration": 0
    }
  },
  "cordova": {},
  "server": {
    "url": "http://localhost:8100",
    "cleartext": true
  }
}

enter image description here

NearHuscarl
  • 66,950
  • 18
  • 261
  • 230
FIRE
  • 151
  • 12
  • 1
    Make sure your device/emulator has access to the same WiFi network that your server is on. If you have multiple networks available when building, the Ionic CLI will let you choose which one to use. – Sébastien Aug 10 '20 at 10:56
  • Does this answer your question? [Ionic 4 net::ERR\_CONNECTION\_REFUSED(http://localhost/)](https://stackoverflow.com/questions/54525558/ionic-4-neterr-connection-refusedhttp-localhost) – Chetan Bansal Aug 13 '20 at 11:15

2 Answers2

1

Try to erase the "url" inside the "server"

0

You trying to reach localhost on emulator but not on remote host. Try to change url to wi-fi network of remote host 192.168.0.* something.

nick shp
  • 90
  • 1
  • 9