简体   繁体   English

Ionic4 电容器 android livereload?

[英]Ionic4 capacitor android livereload?

Is there posibility to run ionic4 app with capacitor on android device with livereload?是否有可能在带有 livereload 的 android 设备上运行带有电容器的 ionic4 应用程序? I was looking for answear for a few hours now without a luck.我在没有运气的情况下寻找了几个小时的 answear。 Please help.请帮忙。

If using a recent version of @ionic/cli , there is a command now ionic capacitor run android --livereload --external如果使用最新版本的@ionic/cli ,则现在有一个命令ionic capacitor run android --livereload --external

You can do it manually too (if not using ionic CLI or using an old version that doesn't have the mentioned command) by adding the server object to the capacitor.config.json file, just use the url of your live reload server您也可以手动完成(如果不使用 ionic CLI 或使用没有上述命令的旧版本),将服务器对象添加到capacitor.config.json文件中,只需使用实时重新加载服务器的 url

"server": {
    "url": "http://192.168.1.33:8100"
}

You can use the following command to livereload without specifying the IP address:您可以使用以下命令进行 livereload,而无需指定 IP 地址:

ionic capacitor run android --livereload --external

The "--external" flag hosts the development server on all network interfaces (like adding --address=0.0.0.0) [1] . “--external”标志在所有网络接口上托管开发服务器(如添加 --address=0.0.0.0) [1] The "--livereload" flag can be shortened to "-l". “--livereload”标志可以缩短为“-l”。

After executing the command, open your native IDE and run the app on the device or simulator.执行命令后,打开您的本机 IDE 并在设备或模拟器上运行该应用程序。 You will know that the livereload server is running when you see the message "Using app server http://xxxx:8100 " (your IP address).当您看到消息“Using app server http://xxxx:8100 ”(您的 IP 地址)时,您就会知道 livereload 服务器正在运行。

You can use the ionic cli for this:您可以为此使用ionic cli:

ionic capacitor run android --livereload

For example.例如。

Source: https://ionicframework.com/docs/cli/commands/capacitor-run来源: https : //ionicframework.com/docs/cli/commands/capacitor-run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM