
You also need to have ndk-build script in your PATH.

In Builder settings fill ndk-build into Build command entry. You have to uncheck Use default build command. Here you have to configure use of ndk-build instead of make all command and set proper include paths.ħ) Choose C/C++ Build and configure ndk-build as a build command

Choose Yes because otherwise you wouldn’t be able to set C/C++ build preferences.Ħ) Click on your project with right button and select Properties or press Alt+Enter Click Finish.Īfter doing this Eclipse will ask you if you want to switch to C/C++ perspective. Then choose your project and below choose Makefile project and - Other Toolchain. This will convert your project into a mixed Java & C/C++ project rather than into pure C/C++ project (the name of the function is misleading).Ĭlick Next. We have to convert the project into mixed Java & C/C++ project.ĥ) Press Ctrl+n (or choose File->New->Other… from main menu) and select Convert to a C/C++ Project. This is because Eclipse threats the project as a pure Java project. c/.cpp file ( native.c in my case) contains a lot of syntax errors which are not truly syntax errors. Take a look into Android ndk docs/ANDROID-MK.html file how to create one.Ĥ) Refresh (F5) directories in Package Explorer to see jni directory here. Also put here Android.mk file which is a makefile that tells Android build-system how to build your files.

If you have another Eclipse release than Galileo choose the appropriate url.Ĭlick Next, Accept licences and finish the installation process.Ģ) In Eclipse create Android project to which you want to add C/C++ code (if you already don’t have one).įor this tutorial I’ve created simple MyAndroidProject.ģ) In file manager create jni/ directory in your project directory and place your C/C++ sources file here. Download it from and unpack it somewhere.ġ) Install CDT (C/C++ Development Tools) into Eclipse.Ĭhoose Help->Install New Software… from the main menu.Ĭhoose as the source site. You need to have Google ADT (Android Development Tools) installed. Programming in C/C++ on Android is just awesome! This tutorial shows how to setup Eclipse for using C/C++ together with Java in Android projects.
