Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing & using the Android NDK in Eclipse

I've been running the Android SDK for a while now in Eclipse (MAC OSX). I've downloaded the NDK and installed the C/C++ tools in Eclipse, but could anyone guide me on using the NDK? For example, do I just create an Android project like normal and build it with the NDK instead?

Really could do with a decent tutorial if anyone know of any.

EDIT: OK so I have the NDK installed now (I think) but does anyone have any idea how to use it? I got as far as this (taken from here):

Run Terminal

cd ~/android-ndk-1.5_r1

make APP=hello-jni

In order to run the hello-jni sample application, but I get an error in terminal saying:

Android NDK: APP variable defined to unknown applications: hellojni
Android NDK: You might want to use one of the following:
build/core/main.mk:81: *** Android NDK: Aborting . Stop.

Any ideas why?

like image 905
ingh.am Avatar asked Aug 12 '10 15:08

ingh.am


People also ask

What is meaning by installing?

Definition of install transitive verb. 1 : to set up for use or service had an exhaust fan installed in the kitchen install software. 2a : to induct into an office, rank, or order installed the new president. b : to place in an office or dignity by seating in a stall or official seat.

When to use install or instill?

To instill means to establish something in one's mind over time. You instill feelings, ideas, or attitudes. To install means to put in position (physically or digitally) ready for use. You install programs, equipment, or machinery.

What is difference between installing and installation?

Trick to Remember the DifferenceInstillation means imparting knowledge gradually or the process of doing so. Installation means something that has been set up or the process of setting something up.


1 Answers

As simply as I can describe it, building an Android app from within Eclipse that uses the NDK requires two steps.

First, inside your terminal you need to run the NDK build script on your project. cd into the root of your project directory and then execute the ndk-build script within that directory.

For example:

cd ~/workspace/hello-jni ./~/android-ndk-1.5_r1/ndk-build 

After doing this, you should see some output that results in the creation of a *.SO file within the obj directory within your project directory.

Once you have the *.SO file, the final step to building an application with the Android NDK through Eclipse is to build it with Eclipse like you would any other application and then deploy it for testing.

If you make any changes to the C/C++ code you'll need to repeat step one and regenerate your *.SO file before building and deploying your application from within Eclipse again.

I would like to note that by using the Android NDK your android apps are still based upon Java. They're just communicating with code written in C/C++ by way of the Java Native Interface.

Finally, I am not aware of any Eclipse plugins that will aid with NDK development. Everything I know about the NDK I have learned the official Android NDK documentation. Please feel free to comment and let me know if there anything I can clear up in my response.

like image 123
Rob S. Avatar answered Sep 23 '22 10:09

Rob S.