Eclipse and Android NDK

Posted: September 25, 2010 in Android, Eclipse
Tags: , , , ,

So I am on the last part of the AndCooperANT journey of adding Android NDK support that set of android application build scripts. So I am using Eclipse 3.5 and Android NDK r4b and need to set up a sample project to test my build scripts.

Here is how I accomplish that so that I have an Eclipse CDT nature within an eclipse Android SDK application project that actually uses the NDK build system and also gets rid of that annoying CDT no gnu makefile at project with all target error…

1. Right click on project root and New Project->Other->C++->Convert to C++

2. check C++ project choose Makefile and choose other toolchain

3. Say yes to open C++ perspective.

4. In C++ perspective create new folders of libs, obj, and jni

5. In C++ perspective under C++ General set output folders under paths to libs and obj and set source folder to jni.

6. In C++ perspective right click project root and select properties than choose builders:

un-check everything on the CDT builder

create a new builder type of program

If using Linux than its

First box ndk-build script location

Second box is project location

Third box is these args: -C ${build_project}

If using Windows the settings for that builder wil be the ones this blog post covers:

http://www.rbgrn.net/content/348-get-your-eclipse-integrated-ndk-on

Now what you should see is after that go to Eclipse project menu and choose Build Project and you should this in your console:

Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /home/fredgrott/my35ws_github/AndCooperANTNDK/jni/Android.mk
make: Entering directory `/home/fredgrott/my35ws_github/AndCooperANTNDK’
make: Leaving directory `/home/fredgrott/my35ws_github/AndCooperANTNDK’
/home/fredgrott/opt/android/android-ndk-r4b/build/core/add-application.mk:98: *** Android NDK: Aborting…    .  Stop.

Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /home/fredgrott/my35ws_github/AndCooperANTNDK/jni/Android.mk    make: Entering directory `/home/fredgrott/my35ws_github/AndCooperANTNDK’make: Leaving directory `/home/fredgrott/my35ws_github/AndCooperANTNDK’/home/fredgrott/opt/android/android-ndk-r4b/build/core/add-application.mk:98: *** Android NDK: Aborting…    .  Stop.

Now click on the problems tab in Eclipse and you should see no pesky CDT no makefile with all target error in that at all in fact you should see an error count of exactly zero.

Enhanced by Zemanta
Advertisements
Comments
  1. […] the original post: Eclipse and Android NDK « MobileBytes […]

  2. Very good contribution thanks you

  3. rangga says:

    thanks about your infor

  4. […] Eclipse and Android NDK « MobileBytes […]

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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