Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ndk build error for Ninja CMAKE_MAKE_PROGRAM is not set

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
like image 732
chefish Avatar asked Feb 13 '19 09:02

chefish


People also ask

Where can I find NDK?

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.

How do I change my NDK location?

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).

What is CMake and ninja?

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.


1 Answers

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
...
like image 92
Aur Saraf Avatar answered Sep 28 '22 00:09

Aur Saraf