opencv4android的第三个sample是带C++的。所以下了NDK,解压了,工程文件还是有错误,提示找不到ndk-build.cmd.
找了好多资料。在环境变量里加个ndk的路径是没用的,右键该project->c++ properties里把cmd的路径改成绝对路径地址也不行。
于是教程提供了在dos里搞的方法,
-
Open console and go to the root folder of an Android application
-
Run the following command
Note
On Windows we recommend to use
ndk-build.cmd in standard Windows console (cmd.exe) rather than the similar bash script in Cygwin shell. -
After executing this command the C++ part of the source code is compiled.
这个方法的必要条件是工程文件要和library文件放一起。
成功!
后来找到了快捷的方法。当然是要下载android-ndk-r8d,环境变量里在系统变量里加个NDKROOT,值就是android-ndk-r8d的路径。然后把property改成这个吊样子
${NDKROOT}/ndk-build.cmd
然后重启下ADT