Search code examples
androidantbuildandroid-ndkandroid-ndk-r5

NDK - Error trying to generate a build.xml file for Hello-jni


I just installed Android NDK, r5b, and while trying to follow the steps from Exploring the hello-jni Sample, on the command line I receive the error:

MacBook-2:~ mvermant$ cd ndk/samples/hello-jni
MacBook-2:hello-jni mvermant$ android update project -p . -s
-bash: android: command not found

I'm using Eclipse Helios release 2 with Android SDK r10 and ADT 10.0.0 on MAC 10.6.6. I have also checked to have GNU Make 3.81, and installed GNU Awk(though I am not sure it's in the right place).

I've searched a lot, and seems there might be a class path missing somewhere, but I can't figure out where exactly and what to do to fix it.


Solution

  • You should make sure the tools directory of your android-sdk is on your (shell) path.

    Something like:

    export PATH="/path/to/sdk/tools:$PATH"
    

    before you execute your command.

    In general you will also need two other directories to be on your path:

    • /path/to/sdk/platform-tools - for adb and other android sdk tools
    • /path/to/ndk - for ndk-build and ndk-gdb, which are ndk tools

    You can also do some setup so that you don't have to run these commands every time you open Terminal.