Issue
I am using the following command to perform live reloading on android
ionic capacitor run android --livereload --external
But it is not working.
Here is the error I am getting
The web page at http://localhost:8100/ could not be loaded because net : ERR_CONNECTION_REFUSED
I know that mobile devices don't understand localhost but I thought --external
flag will take care of it.
Now what I have to do to get live reloading working on android.
Thank you in advance
Solution
Open
android/app/src/main/AndroidManifest.xml
.Add this to your
AndroidManifest.xml
in the tag (Tag application already exists):
<application android:usesCleartextTraffic="true">
may be needed just for API level > 28.
- Run live reload with the host of your PC.
ionic capacitor run android -l --host=127.0.0.1
INSTEAD OF 127.0.0.1
YOU PUT YOUR PC'S IP ADDRESS.
- After run Android Studio with a connected device as usual.
Answered By - Mahdi Zarei
Answer Checked By - Clifford M. (JavaFixing Volunteer)