A simple hello world ionic 3 app working perfectly fine on ionic serve command in browser but when I run it using any of the following commands i am getting an error of “Couldn’t connect to the server. (http://localhost:8080/)”:
Commands:
ionic cordova run android
ionic cordova run android (with liverelad)
removed and added again whitelist and webview (also removed permanently) plugins also removed and added back the android platform.
Also disabled the firewall. Already on same network / wifi (both mobile and pc).
I have searched each and every forum / website pertinent to this error and also tried all the solutions but none of them worked.
I am using genymotion emulator but getting same error on that.
Do you know why Android suddenly needs a local webserver for the webview as well?
I would try to fork the plugin, remove the Android parts, and just use the iOS parts.
Remove the cordova-plugin-ionic-webview that you are using.
Install version 1.2.1 (that supports Android 4.4+, though I don’t know about 4.3).
Remove the android platform (to add again later).
Remove the plugins (to add again later, they should be defined in the config.xml file).
Add the Android platform and the plugins it depends on, and build your app.
ionic cordova platforms remove android (should I run this command?)
I advise you to run it because sometimes the plugins won’t install correctly without a fresh install (just make sure you don’t have made any manual changes to files in the /platforms/android/ folder, and instead used build/hook scripts to populate it).
rm -rf plugins ( error: rm command not found )
If you are on Windows you can just delete the plugins folder in your project, instead of running this command (like with the platforms folder, just make sure you don’t have made any manual changes to files in the /plugins/ folder).
It show white screen of death on my mobile and nothing displayed.
First run the above commands and only after running them successfully try to run your app.
If the error persists, try to create a blank project and then run it in an Android device to see if it works.
If the device you are testing on is using Android 4.x (e.g. Android 4.4 KitKat), this article might explain what is going on and how to fix it: https://ionic.zone/debug/ionic-and-android-4