Skip to content

Update: Adding the NDK (JNI) build to an Eclipse project

October 24, 2012

In a previous post, I explored the use of the OpenSL ES library to implement audio IO natively on Android. This required the creation of a JNI library, which was added to the Eclipse project for the App. In that case, we would run a build script from the command line by changing to the project directory and running

$ sh

The contents of were discussed in that post.

To facilitate things, we can incorporate the build script by going into the Eclipse project properties (right click on the project and select ‘properties’) and:

  1. choose ‘Builders’
  2. click on ‘New’
  3. select ‘Program’
  4. give it a name: ‘JNI build’
  5. On the ‘Main’ tab, in ‘Location’, add the path to your bash command: e.g. /bin/sh
  6. Same tab, in Working Directory, click on Browse Workspace and select your project.
  7. Same tab, in Arguments, add your build script name: e.g.
  8. On the Environment tab, click on ‘New’:
  9. Create a PATH variable and add your command path to it (e.g. /usr/bin:/usr/local/bin:/usr/sbin:/bin:/sbin)
  10. Click on OK.
  11. On the Builder list window, click ‘up’ to move the JNI build to the top of the list.

This will integrate the JNI build in your Eclipse project. The example project in GIT has been updated with these changes:

$git clone


From → Android

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: