4

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:

enter image description here

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:

enter image description here

enter image description here

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:

enter image description here

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.

4

2 回答 2

2

显然,您的 Eclipse 尝试运行的命令(使用该${NDKROOT}/ndk-build.cmd版本时)是C:\\android\\android-ndk-r8d-windows\\ndk-build.cmd,这显然是正确的。

问题是您ndk-build.cmd不是 Windows 命令文件。它应该是。我刚刚下载了 ndk-r8e 的 Windows 版本,ndk-build.cmd 文件被复制到这里

尝试再次下载 ndk 或修改您的 cmd 文件。

于 2013-05-02T06:40:45.917 回答
0

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

于 2013-08-09T21:31:53.433 回答