Skip to Content

Debug Your Mobile Development Kit Application

Learn how to effectively troubleshoot and resolve issues in your Mobile Development Kit (MDK) application through comprehensive debugging techniques.
You will learn
  • How to install MDK Extension in Visual Studio Code
  • How to generate a debug configuration file
  • How to set breakpoints in a rule
  • How to use the debug console
jitendrakansalJitendra KansalApril 17, 2025
Created by
jitendrakansal
June 11, 2024
Contributors
jitendrakansal

Prerequisites

Use the debugging feature provided by the Mobile Development Kit extension for Visual Studio Code to debug your MDK app after bundling it. You can set breakpoints, inspect scope variables, watch expressions, or execute JavaScript code in the rule files.

  • Step 1
    1. This step includes creating the mobile development kit project in the editor. Follow steps 1 and 2 from this tutorial to create your MDK project and deploy to mobile services.

    2. Close the onboarding QR code window, as it is not needed for this tutorial.

  • Step 2

    You will download your MDK project to your local machine. This will be necessary for setting a breakpoint in a rule file in step 9. An alternative option is to use a GitHub repository. See Git Source Control guide for more details.

    1. In SAP Business Application Studio, make sure not to select any file or folder under Explorer, right-click on the blank area and select Download.

      MDK
    2. A file named MDKApp.tar will be downloaded to your machine. Extract the metadata files from the downloaded archive.

  • Step 3
    1. Follow the Build Your Mobile Development Kit Client Using MDK SDK tutorial to create your branded MDK client and run it on a simulator or a device.

    2. After successfully onboarding your mobile client, click Now to accept the app update.

    3. Leave the client running. You will connect the debugger to this client in step 9.

  • Step 4

    In the Visual Studio Code, click the Extensions pane and install the mobile Development Kit extension for Visual Studio Code extension. Alternatively, you can download and install the MDK extension for VS Code from the SAP Software Center (applicable to SAP Mobile Services customer).

    MDK
  • Step 5

    Open the extracted mdkapp folder in the VS Code.

    MDK
  • Step 6

    You will add your debug configurations in launch.json file.

    1. To generate the default launch configuration file, select Run and Debug in the icon panel.

      MDK
    2. Click create a launch.json file option.

      MDK
    3. Select MDK as the debugger type from the list.

      MDK
    4. A launch.json file will be generated.

      MDK
    5. In the launch.json file, set the appRoot attribute for appropriate Mobile Development Kit launch configurations. This should be the path to your create-client command output.

      If you have launched your MDK branded client from terminal or command line via ns run ios or ns run android command, you do not need to set the appRoot attribute for MDK Launch configurations. You can only set the appRoot attribute for MDK Attach configurations.

      Put a comma after watch attribute and add appRoot attribute. Provide the path to your MDK client project folder.

      MDK
  • Step 7

    Make sure you are choosing the right device platform tab above.

    You can debug Android clients from either Window or Mac. iOS clients can only be debugged using a Mac.

  • Step 8

    As the debugger is attached, you can now set breakpoints, inspect scope variables, watch expressions, or execute JavaScript code in the rule files.

    Make sure you are choosing the right device platform tab above.

  • Step 9
    1. Let’s check if there is already result.data available. Switch to the DEBUG CONSOLE tab, enter result.data and press enter.

      MDK
    2. As result.data is true, the Customers_DeleteEntity.action will be executed when pressing the play icon on the Debug Toolbar.

      MDK
    3. To disconnect your debugger, click the red stop icon in the floating bar. Alternatively, you can do it via Run menu> Stop Debugging.

    You have learned how to debug an Mobile Development Kit Client application. Find more information about debugging in MDK in help documentation.


    What debugger type was chosen while creating a launch.json file?

Back to top