Book Image

Android NDK: Beginner's Guide

By : Sylvain Ratabouil
Book Image

Android NDK: Beginner's Guide

By: Sylvain Ratabouil

Overview of this book

Table of Contents (18 chapters)
Android NDK Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – debugging a native Android application


  1. Create file jni/Application.mk with the following content:

    APP_PLATFORM := android-14
    APP_ABI := armeabi armeabi-v7a x86

    Tip

    These are not the only ABIs provided by the NDK; more processor architectures such as MIPS or variants such as 64 bits or hard floats exist. The ones used here are the main ones you should be concerned with. They can easily be tested on an emulator.

  2. Open Project Properties, go to C/C++ Build, uncheck Use default build command and enter ndk-build NDK_DEBUG=1:

  3. In jni/com_packtpub_store_Store.cpp, place a breakpoint inside the Java_com_packtpub_store_Store_getCount()method by double-clicking on the Eclipse editor gutter.

  4. Select the Store project in the Package Explorer or Project Explorer view and go to Debug As | Android Native Application. The application starts, but you will probably find that nothing happens. Indeed, the breakpoint is likely to be reached before the GDB Debugger could attach to the application process...