Building and Debugging the hello-neon Project with VisualGDB

This tutorial shows how to build and debug the hello-neon sample project provided by Android NDK.

Before we begin, ensure that VisualGDB 2.0 or later is installed with the Android Edition.

  1. Start Visual Studio. Go to File->New->Project. Choose VisualGDB->Android Project Wizard. Choose the name and location for the project as you wish. 01-newproject
  2. For this tutorial we are going to copy a sample from the NDK. 02-newandroidproject
  3. If you have not made any Android projects with VisualGDB before, press on ‘Configure NDK/SDK locations’. There either browse to the needed tools or development kits or start installing them. 03-androidsettings
  4. Press ‘Next’ in the wizard. Choose the hello-neon sample project. 04-sampleselection
  5. Press ‘Next’. Choose an Android platform 3 or higher. Choose the option of multiple libraries. Press ‘Finish’.
    The option ‘The JNI Folder folder contains multiple libraries’ needs to be selected as the Android.mk file for this project includes the source files separately.05-platformselection
  6. Connect a device with armeabi-v7a or start a virtual device with ABI armeabi-v7a (Android 4.0 or later). 06-avdmanager
  7. If the app reports that it has no ARMv7 support although the device supports it, modify the Application.mk file to have only the armeabi-v7a target. Note that if you have already built the app, please delete the bin, obj and libs subfolders after you have modified Application.mk. 07-applicationmkchange
  8. Build the project by going to Build->Build Solution. 08-building
  9. Launch the project by going to Android->Launch Android App. A successful launch looks as follows i.e. there must be a value for the Neon version. Note that Neon instructions are slower on the emulator. 09-running
  10. Add a breakpoint to line 106 of helloneon.c. 10-breakpoint
  11. Start debugging. When prompted choose ‘Restart the first activity’. 10a-restart
  12. When the breakpoint is hit take your time looking at the autos etc. Continue debugging when ready. 11-stopped
  13. Look at the time difference between the Neon and C versions. Now the C version is much slower as stopping at our breakpoint affected the time calculations for it. 12-running_changed