我下载了 ndk cmake 和 LLDB 进行 ndk 开发。然后我创建一个项目C++代码,应用程序编译错误。
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
...
Configuration failed.
External native generate JSON debug: JSON generation completed with problem
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateJsonModelDebug'.
com.android.ide.common.process.ProcessException: Error configuring
我用Valentin Safonnikov的评论解决了这个问题:
"与其更改全局路径,不如将 cmake 的路径添加到与 gradlew 相同的目录中的 local.properties 文件中。
cmake.dir=D:\Android\sdk\cmake\3.10.2.4988404
">
编辑:我只认为它已经解决了。当我卸载 cmake 3.10 并只安装 cmake 3.6 时,所有问题才最终得到解决(即使有 3.10 cmake.dir=...\3.6...
,它也一直使用 3.10 .我可以在文本 gradle 输出中看到这一点:
External native generate JSON debug: executing cmake Executable : C:UsersUserAppDataLocalAndroidSdkcmake3.10.2.4988404bincmake.exe
arguments :
...
-DCMAKE_MAKE_PROGRAM=C:UsersUserAppDataLocalAndroidSdkcmake3.6.4111459binninja.exe
...
我已经通过将忍者添加到路径来解决问题。
/Users/fish/Library/Android/sdk/cmake/3.10.2.4988404/bin