Build and run Android NDK applications without Eclipse

If you already have a development environment and do not wish to use Eclipse, you can easily build and run your NDK application from makefiles or the command line.

First of all, you need to set the ANDROID_NDK_ROOT environment variable and ensure the SDK and NDK binary directories are in PATH. Here are my definitions:


This is best defined in one of your shell’s startup scripts such as .zshenv.

Build and install package

Now, whenever you are in an NDK project’s directory, build the project using:

ndk-build && ant release

And to upload it to the emulator or to a connected device:

ant release install

That’s all! Those two simple commands can easily be launched from your preferred development environment.

Update: ant compile no longer exists in recent SDKs; replaced with ant release.

Run package

You can use adb to run any application remotely. For instance:

adb shell am start -a android.intent.action.MAIN -n $PACKAGENAME/.$ACTIVITYNAME

Both package name and activity name can be found in your AndroidManifest.xml.

  • Posted: 2011-03-11 01:26 (Updated: 2012-09-23 18:55)
  • Author: sam
  • Categories: android code tip


1. anonymous -- 2012-09-20 17:13

This is only build and install, how about run?!

2. sam -- 2012-09-23 18:56

@anonymous: you’re right, I lied about the running! I added the relevant information.

130. jzakCoame -- 2017-01-02 11:37

kv9396 cheap generic levitra online ao4079dz2028sg7619 wz3647

133. BiesCaw -- 2017-01-02 14:46

Hello, I just wanted to say hi, great to be here, engaging comunity! In come what may you interested, my website:

138. udtpBleby -- 2017-01-02 21:03

jx3405 buy levitra online australia ye5877wv6144cl6031 wf7338

141. ieotCoame -- 2017-01-03 04:45

ea3796 sildenafil pediatric dosing ng2269qy4351bn880 kt4780lt7728

148. Smitha414 -- 2017-01-03 16:11

Howdy would you mind sharing which blog platform you're working bedbffecaekeakge

163. Smithc114 -- 2017-01-04 23:36

Thanks for this article. I might also like to say that it can end up being hard if you find yourself in school and merely starting out to create a long credit rating. There are many learners who are only trying to endure and have long or good credit history are often a difficult issue to have. aagkdefdgeeedabe

203. Smithg23 -- 2017-02-20 18:50

Your style is really unique compared to other folks I've read stuff from. kekacafkddackabb

Add New Comment