Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ndk-build.cmd command not found

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
like image 216
Gufran Khurshid Avatar asked Oct 19 '22 08:10

Gufran Khurshid


2 Answers

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.

like image 178
jww Avatar answered Oct 21 '22 21:10

jww


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

like image 22
Hitesh Modhwadia Avatar answered Oct 21 '22 22:10

Hitesh Modhwadia