Fix: Cordova App on Android shows blank screen with ERR_CONNECTION_REFUSED

Problem: The Cordova App when run on Android give a Connection refused error on https://localhost/* URLs.

Fix: Follow these steps:

  • Edit package.json
  • Set homepage from “./” to “https://10.0.2.2/”
  • Save, build and run the App.

Probable Reason: Localhost seems to get routed to the host while the emulator runs the App within a virtual container (assumption).
10.0.2.2 is a special IP mapped to the “localhost” of the emulated environment.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *