Reputation: 622
So ive been wresting with this for like 3 hours so decided to ask a question. I must have read 10 different articles and still cant get it to work.
I am trying to set up OpenCV in an android project.
My environment variables are as follows in ".bash_profile"
export ANDROID_SDK="/Applications/eclipse/sdk"
export ANDROID_NDK="/Users/eharpham/Documents/eclipse/android-ndk-r8d"
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK"
Typing "env" in terminal shows these correctly:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/eclipse/sdk/tools:/Applications/eclipse/sdk/platform-tools:/Users/eharpham/Documents/eclipse/android-ndk-r8d
ANDROID_SDK=/Applications/eclipse/sdk
ANDROID_NDK=/Users/eharpham/Documents/eclipse/android-ndk-r8d
I am using macbook and adt-bundle-mac-x86_64-20130522.
I have set the following:
ADT > Preferences > C/C++ > Environment:
Variable "ANDROID_NDK", Path "/Users/eharpham/Documents/eclipse/android-ndk-r8d"
ADT > Android > NDK >:
/Users/eharpham/Documents/eclipse/android-ndk-r8e
Project > Properties > C/C++ Build:
Changed ${NDKROOT}/ndk-build.cmd to ${NDKROOT}/ndk-build
Project > Properties > C/C++ Build > Environment:
I have so tried this without the PATH above.
Getting the error:
Cannot run program "/ndk-build": Unknown reason
Error: Program "/ndk-build" is not found in PATH
PATH= [/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/eclipse/sdk/too ls:/Applications/eclipse/sdk/platform-tools:/Users/eharpham/Documents/eclipse/android-ndk-r8d]
The only error I can see is in Android Libraries:
This is driving me insane any assistance hugely appreciated.
Upvotes: 1
Views: 5472
Reputation: 323
This worked for me:
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 these 2 items, CWD and PWD (I see that you have PATH and ANDROID_NDK in yours also. Click the button that reads '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 (you should be able to see the ndk-build.cmd file there).
Click on 'Apply". If this doesn't do the job then maybe experiment with removing the ANDROID_NDK item and the PATH items.
Upvotes: 1
Reputation: 342
I had the same problem. I have done the following steps and fixed my issue
Upvotes: 1
Reputation: 57203
In ADT > Preferences > Android you should set the path to NDK: . Yes, you already set in your environment and added it to the shell, but that's not enough. Eclipse Android plugin wants this info separately.
Upvotes: 2