[英]How to LiveReload and debug Ionic/Capacitor application on Android device/emulator
I'm new to Ionic and want to debug the Ionic app that's running on Android device (and emulator).我是 Ionic 的新手,想调试在 Android 设备(和模拟器)上运行的 Ionic 应用程序。
I've followed the official documentation for debugging and livereload , but still the breakpoint is never hit on VS Code from Android devices.我已经按照官方文档进行了调试和livereload ,但是在 Android 设备的 VS Code 上仍然没有遇到断点。
Also I've played a lot with sourceMapPathOverrides
but no result.我也玩了很多
sourceMapPathOverrides
但没有结果。
Can we somehow debug the Ionic/Capacitor app that's running on Android device using VS Code (no Chrome pls) and with LiveReload support?我们可以使用 VS Code(无 Chrome pls)并支持 LiveReload 以某种方式调试在 Android 设备上运行的 Ionic/Capacitor 应用程序吗?
PS I know the question is a bit general, but this is a question that many beginners (like me) face and a few-hours-googling doesn't provide an all in one solution guide of how to do that, especially if you're on Capacitor. PS我知道这个问题有点笼统,但这是许多初学者(像我一样)面临的问题,并且几个小时的谷歌搜索并没有提供如何做到这一点的一体化解决方案指南,特别是如果你重新上电容器。
Had to figure it out by my own...只好自己想办法了。。。
Here's the guide of how to debug the Ionic/Capacitor app that's running on Android via VS Code:以下是如何通过 VS Code 调试在 Android 上运行的 Ionic/Capacitor 应用程序的指南:
launch.json
file in VS Code:launch.json
文件中: {
"type": "android-webview",
"request": "attach",
"name": "Attach to Android WebView",
"webRoot": "${workspaceFolder}/*",
"sourceMapPathOverrides": {
"webpack:/*": "${workspaceFolder}/*"
}
}
adb devices list
adb -s [DEVICE-ID] reverse tcp:8100 tcp:8100
ionic cap run android -l
Some resources that might be useful for troubleshooting:一些可能对故障排除有用的资源:
https://ionicframework.com/docs/cli/livereload https://ionicframework.com/docs/cli/livereload
https://ionicframework.com/docs/troubleshooting/debugging https://ionicframework.com/docs/troubleshooting/debugging
Ionic emulate android ERR_CONNECTION_REFUSED localhost:8100 离子模拟 android ERR_CONNECTION_REFUSED localhost:8100
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.