Gufran Khurshid
Gufran Khurshid

Reputation: 939

ndk-build.cmd command not found

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

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

Upvotes: 5

Views: 13332

Answers (2)

Hitesh Modhwadia
Hitesh Modhwadia

Reputation: 222

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

Upvotes: 1

jww
jww

Reputation: 102306

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.

Upvotes: 2

Related Questions