on 2025 Aug 04 3:08 AM
Hello everyone,
I'm facing a persistent issue while trying to debug my SAP MDK application locally on Windows using an Android emulator. The debug session starts correctly and hits breakpoints, but it terminates immediately whenever I type anything in the Debug Console within VS Code. I’d really appreciate help in understanding and resolving this behavior.
In addition to that, when I try to run the "MDK Attach on Android" debug configuration in VS Code, the application is not automatically (re)installed on the emulator with the updated bundle. I need to run the application in "MDK Launch on Android" mode to install the app, which breaks the expected debug flow. I've tried use the both modes to debug.
Debugger Steps
Open the MDK project in Visual Studio Code.
This makes it impossible to inspect variables or evaluate expressions dynamically during debugging.
Development Environment
Steps Taken
What I've Already Tried
Updated and adjusted launch.json with different "trace", "sourceMaps", and "watch" settings.
Request clarification before answering.
I always use Attach on Android for my debugging but when doing this I also have a terminal window open where I have executed ns run android --emulator --no-hmr and the command is still running providing console output to the terminal. In this scenario when I run the Build Task from within VS Code it copies the updated bundle to the client and because the ns run is still active in the terminal window it relaunches the client. The downside is that the relaunch will disconnect the debugger. As a result I typically use App Update an deploy from VSCode to App Update and Check for Updates in my client to pickup the changes. This does not disconnect the existing debugger.
Regarding the typing in the debug console terminating the session this is something we are aware of and working to find a solution. The Debug Console does support dynamic input during paused breakpoints in MDK/NativeScript apps. This is currently only affecting Android (on both Windows and Mac) in the more recent versions.. The workaround is to paste the statement you want to execute into the debug console. Then it works as expected. So I am currently opening a new tab as a scratch pad to type out commands to copy and paste into the debug console if it isn't something I can copy and paste directly from the source code view.
Hope this helps.
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much for your help, Bill! This approach worked for what I needed.
Just to share with everyone: first, I ran the build task, and then I launched the MDK app using the "MDK Launch on Android" mode. This way, I didn't lose the auto-refresh functionality, and the build task ran automatically.
To view a variable's value at runtime, I simply copied the variable I needed and pasted it into the Debug Console.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.