2.9.2 Downloading and debugging an Android application in DS-5

This tutorial describes how to create a debug configuration, download the application on to your target, and connect to your target using DS-5.

Prerequisites

  • One of the sample applications provided with Android NDK is hello-neon. You must have already built the application and have access to the source location.
  • Your target must already be up and running. If you are using an Android Virtual Device (AVD), your device emulator should be configured with the appropriate API levels and CPU settings. It must also be up and running for DS-5 to connect to it.
  • The Android SDK source folder must be available under your operating system PATH environment variable. If not, add the ...\android-sdk\platform-tools folder to your PATH environment variable.

Procedure

  1. Start DS-5, and in the main menu, select Run > Debug Configuration.
  2. Select DS-5 Debugger from the configuration tree and click New Configuration New to create a new debug configuration.
  3. In the Debug Configurations dialog, under the Connections tab:
    1. Give the debug configuration a Name. For example, HelloNeon.
    2. Under Select target, browse and select Android Application Debug > Native Application/Library Debug > APK Native Library Debug via gdbserver > Download and debug an Android application.
    3. Under Connections, select your target. For example, emulator-5554.
      Figure 2-12 Debug Configuration dialog-Connection tab-Download and debug an Android application
      Debug Configuration dialog - Connection tab - Download and debug an Android application

  4. In the Files tab of the Debug Configurations dialog:
    1. Under Android > Project directory select the folder where the hello-neon application sources are stored. This automatically populates other fields.
      Figure 2-13 Debug Configuration dialog - Files tab - Select Project directory
      Debug Configuration dialog - Files tab - Select Project directory

  5. In the Debugger tab of the Debug Configuration dialog:
    1. Under Run control, select Connect only.
    2. Under Paths, browse and select the hello-neon source directory.
    Figure 2-14 Debug Configuration dialog - Debugger Tab - Connect only (Android)
    Debug Configuration dialog - Debugger Tab - Connect only (Android)

  6. Click on Debug to connect to the target.
  7. Debugging requires the DS-5 Debug perspective. If the Confirm Perspective Switch dialog box opens, click Yes to switch perspective.
  8. To debug the application, set breakpoints, run, and step as required.

    Note

    If the application exits before NDK can attach gdbserver to the native library then you might need to add a delay before launching the Java native libraries.
Non-ConfidentialPDF file icon PDF versionARM DUI0446W
Copyright © 2010-2015 ARM. All rights reserved.