Developer

Debugging on Android

Use Web Inspector to debug an Android app that includes Apache Cordova and Kapsel plugins.

Prerequisites

  • Android device running Android 4.4 or higher, or Google Nexus device running Android 4.2 or higher.
  • If using a Google Nexus device, install the device's USB driver by following the instructions at http://developer.android.com/tools/extras/oem-usb.htmlInformation published on non-SAP site.
  • If debugging a device connected via USB, enable the Developer Options menu item:
    • For Android devices, go to Start of the navigation path Settings Next navigation step Developer Options Next navigation step  USB Debugging Next navigation step  End of the navigation path.
    • For Google Nexus devices, go to Start of the navigation path About Next navigation step Settings Next navigation step Build number End of the navigation path (tapping on Build number several times).

Procedure

  1. Start the app on the device.
  2. From your desktop, in Chrome (version 30 or higher), enter chrome://inspect in the URL.
  3. (Optional) To debug starting from the init method, set a breakpoint in the init method using one of the following:
    • In the console, enter:
      window.location.reload()
    • Call:
      cordova.fireDocumentEvent('deviceready');
  4. (Optional) Choose one or more breakpoints to step through. The chosen breakpoints display in the Breakpoints panel.
  5. (Optional) From the Elements panel, choose an HTML element to view, or modify its HTML and CSS properties.
  6. (Optional) In the Console drawer, enter commands to modify the source file code.
  7. (Optional) From the Network panel, examine data URL requests and responses (values received).

    For more information about debugging on Android with Chrome, see https://developer.chrome.com/devtools/docs/remote-debuggingInformation published on non-SAP site.