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.

Kj
Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

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