Ask Your Question

ndk-build not found in PATH

asked 2014-12-31 06:43:23 -0500

jiarongkoh gravatar image

updated 2015-01-01 09:41:16 -0500

Hi all

I just got started with OpenCV and was trying to begin with the sample apps. For some reason I can't get three of the apps to work. The compilation throws the following errors:image description

I tried to search for solutions but non of the solutions seem to work. I've tried:

  • Reinstalling the android ndk
  • included NDKROOT in build environment which direct to my android ndk directory

Pls help, I have no idea what to do already.

EDIT I realised that the android-ndk needs to be placed in a directory without spaces as required by android and thus i moved those relevant files. But I am still getting the exact same errors. I did the set up in environment variable as stated in the docs to use ndk-build, instead of ndk-build.cmd. image description image description

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2015-01-03 23:55:21 -0500

jiarongkoh gravatar image

I manage to solve it. In fact both comments from Shirdutt and Mirza were the answers. I did not include the ndk path in my environment setting and included the .cmd behind ndk-build. The sample projects are all working fine after performing these actions.

edit flag offensive delete link more

answered 2015-01-01 03:50:43 -0500

shridutt kothari gravatar image

Perform following steps:

  1. Create NDKROOT environment variable pointing to C:\Program Files (x86)\android-ndk-r10d
  2. Append ";C:\Program Files (x86)\android-ndk-r10d\ndk-build.cmd" in your path variable inside environment variable.
  3. In eclipse go to projects->properties->C/C++ build->Build command->${NDK_ROOT}/ndk-build.cmd

- Thanks & regards, Shridutt Kothari [email protected] Impetus Infotech India Ltd.

edit flag offensive delete link more


Hi Shirdutt, thanks for replying! I believe that OpenCV indicated to remove the .cmd from ndk-build but I did try your approach to include the .cmd. The application build successfully but it crashes throwing the following errors java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.opencv.samples.tutorial2/org.opencv.samples.tutorial2.Tutorial2Activity}: java.lang.ClassNotFoundException: Didn't find class "org.opencv.samples.tutorial2.Tutorial2Activity" on path: DexPathList[[zip file "/data/app/org.opencv.samples.tutorial2-2/base.apk"],nativeLibraryDirectories=[/data/app/org.opencv.samples.tutorial2-2/lib/arm, /vendor/lib, /system/lib]]

Any idea what might this mean?

jiarongkoh gravatar imagejiarongkoh ( 2015-01-01 09:49:30 -0500 )edit

answered 2015-01-01 03:39:03 -0500

Mirza gravatar image

you have to set the ndk path in environment variable.and then in command prompt go to the application folder type ndk-build then .so files will be created in libs/<architecture folder=""> in main application folder.Clean and run the application

edit flag offensive delete link more


Hi Mirza, thanks for replying but I don't quite understand your approach. I believe I've did the required ndk path setting in environment variable. So you are saying that I should go into the cmd prompt and navigate to the sample application and type ndk-build to generate a .so file?

jiarongkoh gravatar imagejiarongkoh ( 2015-01-01 09:43:12 -0500 )edit

Question Tools



Asked: 2014-12-31 06:43:23 -0500

Seen: 5,377 times

Last updated: Jan 03 '15