Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Program "/ndk-build.cmd" is not found in PATH

I am stuck with this following problem on Mac OS X(10.8.4) and eclipse JUNO since 10 days and I haven't found anything working on web.

I have downloaded and unzipped the android NDK. After that, I have set the NDK location in 'Android' option in preferences menu. I want to run a sample opencv code(https://www.dropbox.com/s/6s3qwkon9v67u5z/tutorial-3-native.rar) on the android ADT.

While building, it gives the following console output

**** Build of configuration Default for project OpenCV Sample - native-activity ****

"/ndk-build" 

Cannot run program ""/ndk-build"": Unknown reason
Error: Program ""/ndk-build"" is not found in PATH

PATH=[/usr/bin:/bin:/usr/sbin:/sbin]

**** Build Finished ****

I don't know anything about PATH variables/Environment Variables. Please provide step by step procedure to rectify the above error.

like image 590
mohit Avatar asked Jul 16 '13 07:07

mohit


2 Answers

In Eclipse, highlight your Project, then from the Eclipse menubar at the top, select 'Project->Properties'.

In the list on the left, click on the arrow next to the item 'C/C++ Build' and highlight the item 'Environment'.

In the box that reads 'Environment variables to set' you will have 2 items, CWD and PWD. Click the button that read 'Add...'

In the box that appears, select the Name field and type in NDKROOT.

In the field that reads Value type in the path to where you unzipped the Android NDK.

Click on 'Apply". Boom, done. Do this to any other projects that rely on the NDK.

like image 150
DasBoos Avatar answered Sep 20 '22 14:09

DasBoos


ndk-build is in the root of the NDK folder.

If printenv PATH | grep ndk does not return a string, you cannot call it.

Append the following to $HOME/.bash_profile:

export NDK_ROOT="<whatever your NDK directory is>"
export PATH="$PATH:$NDK_ROOT"

Then, from the command prompt, type:

. ~/.bash_profile

Now you can run ndk-build from the command prompt.

like image 44
Michael Labbé Avatar answered Sep 16 '22 14:09

Michael Labbé