Exploring the Android NDK Android

The Android NDK contains a number of different tools and files, specifically

  • Native system libraries and headers that are forward-compatible with the Android platform (1.5 and beyond)
  • Tools for compiling and linking native libraries for ARMv5TE and ARMv7-A devices (x86 coming soon)
  • Build files for embedding native libraries into Android applications
  • Native debugging using ndk-gdb
  • NDK documentation in the /docs subdirectory
  • NDK sample applications in the /samples subdirectory

Running an Android NDK Sample Application

The best way to familiarize yourself with the Android NDK is to build one of the sample applications provided, such as hello-jni. To do this, take the following steps:

  1. Build the hello-jni native library, located in the NDK /samples/hello-jni subdirectory, by typing the following on the command line (within Cygwin on Windows): ndk-build.
  2. Within Eclipse, import the existing project from the /samples/hello-jni/project/ subdirectory of the NDK installation directory by choosing New, Android Project and then choosing the Create from Existing Source option. Do a clean build on the project.
  3. Create a Debug Configuration for the project.
  4. Create an appropriate AVD if necessary. Run the application as normal.
  5. If you get errors, you might need to do a “Clean project” within Eclipse after running an ndk-build clean and ndk-build again. It’s not uncommon for Eclipse’s state to get out of sync with the build status of the native library.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Android Topics