I'm new to Ionic and want to debug the Ionic app that's running on Android device (and emulator).
I've followed the official documentation for debugging and livereload , but still the breakpoint is never hit on VS Code from Android devices.
Also I've played a lot with sourceMapPathOverrides
but no result.
Can we somehow debug the Ionic/Capacitor app that's running on Android device using VS Code (no Chrome pls) and with LiveReload support?
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.
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:
launch.json
file in VS Code: {
"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/troubleshooting/debugging
Ionic emulate android ERR_CONNECTION_REFUSED localhost:8100
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.