Configure Live Reload Server Url #3531
-
In the capacitor configuration file options docs, there is a configuration option for "server" and key "url" like this: "server": { This config option is automatically added to the capacitor.config.json file automatically after running with the live-reload option, for instance: ionic capacitor run android --l --external The problem is that the server url has changed on me a couple of times when I run with livereload. This causes a couple of issues with security exceptions like allowClearText. Is there a way to set the livereload url so that it runs on the same address every time? Here's my capacitor version info: Capacitor: Capacitor CLI : 2.4.0 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Since live reload generally works over Wi-Fi and the address of your computer is determined by your router, not the Ionic CLI or Capacitor CLI, this isn't something we can support as a configuration option. However, for Android you could set up port forwarding with adb (making sure your device is plugged into your computer first):
It's important to change Then, with the Ionic CLI, drop the |
Beta Was this translation helpful? Give feedback.
-
Hey @imhoffd, If I do what you suggested with a plugged-in Android Device, it works on my new Mac (M2). Strange fact is that on my old Mac (Intel) fi I run the following command it works perfect: If I do the same on my new Mac (M2), everything is fin it loads the app but then get's stuck right there when it just opened the app and my device is also no were to be found in I tried a lot of things, but nothing worked. Can't even remember how many variations I tried. This are some logs:
These are some errors I get when I have Android Studio open: Everything works fine if I do not use live reload. I really want to get this fixed. 🙏🏻 |
Beta Was this translation helpful? Give feedback.
Since live reload generally works over Wi-Fi and the address of your computer is determined by your router, not the Ionic CLI or Capacitor CLI, this isn't something we can support as a configuration option.
However, for Android you could set up port forwarding with adb (making sure your device is plugged into your computer first):
It's important to change
8100
to whichever port is being used, if necessary.Then, with the Ionic CLI, drop the
--external
flag which should serve your app onlocalhost
.