Android NDK | Techbirds

NDK Development Guide

Prerequisites:

  1. Install C/C++ support for eclipse ADT
  • In your ADT, click help –> Install new software –> –> from “Programmin Languages” –> select CDT Development tools.
  • Click install.
  1. Install Cygwin (if you are working on windows).
  • Download cygwin from https://cygwin.com/  and do install the “make” tool
  1. Download NDK from developers.google.com
  1. Define environment variables
  • NDK_HOME: to ndk extract directory
  • CYGWIN_HOME: to cygwin installed directory
  • CYGWIN: nodosfilewarning

Steps for creating project for android NDK.

  1. Place your native sources under /jni/…
  2. Create /jni/Android.mk to describe your native sources to the NDK build system
  3. Optional: Create /jni/Application.mk.
  4. Build your native code by running the ‘ndk-build’ script from your project’s directory. It is located in the top-level NDK directory
    1. cd
    2. /ndk-build
    3. The build tools copy the stripped, shared libraries needed by your application to the proper location in the application’s project directory.
    4. Finally, compile your application using the SDK tools in the usual way. The SDK build tools will package the shared libraries in the application’s deployable .apk file

To build a header file use following command:

javahjni -classpath ../../bin/classes;”C:\Program Files\Android\android-sdk\platforms\android-17\android.jar” -o < “.class” classFilename>

Reference : android-beginners-ndk-setup-step-by-step
Linchpin Technologies Pvt Ltd, a mobile app development company India , is globally recognized as enterprise app development company

902 total views, 1 views today

Tags: Android NDK, Cygwin, native development android