2014년 2월 2일 일요일

Setup Android NDK under windows


1. Install cgywin.
 Because windows doesn't have gcc build env, we must install cgywin
 Dowload cgywin here
 http://www.cygwin.com/
 and choose install option only devel

In Korean case, add this http://ftp.daum.net/cygwin for download mirror site.

2. Install Android NDK

downlodd Android NDK here and unzip
http://developer.android.com/tools/sdk/ndk/index.html

For convenience, I unziped it on cygwin/home/administrator directory

3. Setup path

Open .bashrc or .bash_profile export NDK directory
( In my case it located on C:\cygwin\home\Administrator )
export ANDROID_NDK_ROOT=/home/Administrator/android-ndk-r9

Add NDK directory to path
PATH="$PATH:$ANDROID_NDK_ROOT"

Save and close

4. Check NDK sample build
 Move to NDK sample directory and build

$ cd android-ndk-r9/samples/hello-jni/jni
$ ndk-build

then you can see belows

Gdbserver      : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
Gdbsetup       : libs/armeabi/gdb.setup
Cygwin         : Generating dependency file converter script
Compile thumb  : hello-jni <= hello-jni.c
SharedLibrary  : libhello-jni.so
Install        : libhello-jni.so => libs/armeabi/libhello-jni.so

참 쉽죠~~