简体   繁体   中英

Building OpenCV 2.4.5 in android ADT: “ndk-build” not found in PATH

I'm trying to follow this OpenCV document to import OpenCV sample projects into the android ADT, and am getting the now infamous "Program "C:\\android\\android-ndk-r8d-windows\\ndk-build" not found in PATH" error. My OS is Windows 7 and I use cygwin for any Linux-like commands.

Please note: I already downloaded the NDK package, and already set the value of NDKROOT to be my NDK root folder. I setup NDKROOT both as a system-wide environmental variable, and as an ADT's C/C++ Build environment variable, as shown below:

在此处输入图片说明

In my NDK root folder, I made identical copies of the file "ndk-build.cmd", and renamed them as "ndk-build" and "ndk-build.sh" respectively. I chmod+x to all three ndk-build* files.

Now what happens is really puzzling: If I specify the C/C++ Build command to be ${NDKROOT}/ndk-build or ${NDKROOT}/ndk-build.sh, I get the error "Program "C:\\android\\android-ndk-r8d-windows\\ndk-build" not found in PATH". However, if I specify it to be ${NDKROOT}/ndk-build.cmd, ADT apparently finds it, but tries to run it as a Windows command, not as a bash script, as shown below:

在此处输入图片说明

在此处输入图片说明

The only way I can build a project, is to open a cygwin terminal, cd to the sample project folder, and run the script (either ndk-build or ndk-build.sh), like this:

在此处输入图片说明

I googled around for a solution. Although there are lots of "ndk-build.cmd not found in PATH" questions, I have not seen a case like mine. What is happening? I might also post my question to the openCV forum.

Apparently, the command that your Eclipse tries to run (when using the ${NDKROOT}/ndk-build.cmd version) is C:\\\\android\\\\android-ndk-r8d-windows\\\\ndk-build.cmd , which is apparently correct.

The problem is that your ndk-build.cmd is not a windows command file. And it should be. I just downloaded the Windows version of the ndk-r8e and the ndk-build.cmd file is copied here .

Try to download the ndk again or to modify your cmd file.

您应该以与PATH变量相同的方式添加${NDKROOT}变量(NDK所在的文件夹)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM