8/09/2015

Android-NDK Eclipse setup


1. Download Eclipse for C/C++ or Eclipse for Jave but you need to download CDT

Eclipse for C/C++


2. Install Android Developer Tools (ADT)

Choose Help->Install New Software from the main menu. 


3. Download Native Development Kit (NDK)

Download NDK and extract it.

Go to Window->Preference->Android->NDK  
Locate your NDK Path




















4. Try to import a NDK project containing Android.mk amd Applicaiton.mk already
$ git clone https://github.com/julienr/libpng-android.git

Open Eclipse and import C/C++ Project (Select C/++ -> Existing Code as Makefile Project)























Give a project name,  locate code path, select Android GCC tool chain.































You can check your project's properties. You build command should be 'ndk-build'. IDE should include android-ndk's headers in C/C++ -> General Path and Symbols.



























5. Start to build it 

Choose Project->Build Project from the main menu.

If your project is executable, you push and test it on your Android device.

$ adb push [/local/path/binary] /data/local/tmp

$ adb shell ./data/local/tmp/[binary]

No comments:

Post a Comment