While trying to develop Hello World NDK program on Ubuntu with following parameters
/home/gufran/ADT2/sdk
/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
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With