5

While trying to develop Hello World NDK program on Ubuntu with following parameters

  • sdk path is /home/gufran/ADT2/sdk
  • ndk path is /home/gufran/ADT2/android-ndk-r10e

I have successfully generated com_appxperts_firstndkapp_MainActivity.h and also MyJNI.c. Now I would like generate the .so files with command

home/gufran/ADT2/android-ndk-r10e/ndk-build.cmd

but its giving error

bash: home/gufran/ADT2/ndk/ndk-build.cmd: No such file or directory

Also tried

ndk-build.cmd

still error

ndk-build.cmd: command not found

Please note the NDK path is already set as

gufran@gufranKhurshid:~$ export NDK_HOME=home/gufran/ADT2/android-ndk-r10e
3
  • Ndk-build. No "cmd" in expression Commented Jun 27, 2015 at 8:45
  • Can you please write the full command as ndk-build without (.cmd ) is also not working. Commented Jun 27, 2015 at 8:47
  • Possible duplicate of Error: Program "/ndk-build.cmd" is not found in PATH Commented Jun 28, 2015 at 22:41

2 Answers 2

2

ndk-build.cmd command not found...

Put your tools on path. Also, you should export ANDROID_NDK_ROOT and ANDROID_SDK_ROOT. See David Turner's answer to Recommended NDK Directory? on the NDK mailing list for the reasons.

Here's what my .bash_profile looks like on OS X. For Ubuntu, I believe you use .profile. Tools like ndk-build and keytool are on path:

$ cat ~/.bash_profile
export PS1="\h::\W$ "
...

# Android
export ANDROID_NDK_ROOT=/opt/android-ndk-r10e
export ANDROID_SDK_ROOT=/opt/android-sdk-macosx

export ANDROID_HOME=~/.android
export JAVA_HOME=`/usr/libexec/java_home`

export PATH="$ANDROID_SDK_ROOT/tools/":"$ANDROID_SDK_ROOT/platform-tools/":"$PATH"

Finally, run ndk-build, not ndk-build.cmd. I believe ndk-build.cmd is for Windows.

Sign up to request clarification or add additional context in comments.

1 Comment

ndk-build.cmd is indeed for Windows. On Linux and Mac OS X, it's ndk-build that should be executed instead.
1

First of all, locate your jni directory of your project in command-prompt if your .c files are available in it.Then just type command :

export NDK=enter your ndk path here  
export PATH=$NDK:$PATH 

then, run command ndk-build. it will generate your *.so files in libs folder

1 Comment

I got this error line 2: dirname: command not found line 3: /Users/mdmaidul.islam/Documents/RD/NaussSample/build/ndk-build: No such file or directory. Please help me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.