I download ndk cmake and LLDB for ndk development.And then I create an project with c++ code,the application compiled error.
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
Android Studio installs all versions of the NDK in the android-sdk /ndk/ directory. Each version is located in a subdirectory with the version number as its name.
Once you have downloaded the NDK, go to "File" menu, than "Project Structure->SDK Location" and set the Android NDK Location (it is at the bottom of the window).
CMake is a build generator while Ninja is a build tool. CMake can use any build tool like Make or Ninja while Ninja has to use CMake as its build generator which is compulsory. CMake was developed in 2000 by Kitware. On the other hand, Ninja was developed by Google in 2012 that is 12 years after CMake.
I resolved the issue with Valentin Safonnikov's comment:
"Instead changing global path, you can add the path to cmake into local.properties file in the same dir as gradlew.
cmake.dir=D\:\\Android\\sdk\\cmake\\3.10.2.4988404
"
Edit: I only thought it was solved. All issues were only finally solved when I uninstalled cmake 3.10 and left only cmake 3.6 installed (it kept using 3.10 even with cmake.dir=...\\3.6...
. I could see this in the textual gradle output:
External native generate JSON debug: executing cmake Executable : C:\Users\User\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\cmake.exe
arguments :
...
-DCMAKE_MAKE_PROGRAM=C:\Users\User\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With