9

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
3
  • You downloaded CMake with the SDK Manager right? Not from some other place. I have three cmake versions in my Android SDK directory, and all of them contain ninja.exe in their bin subdirectory. Commented Feb 13, 2019 at 10:18
  • I downloaded CMake by Android studio.There is ninja in the directory /Users/fish/Library/Android/sdk/cmake/3.10.2.4988404/bin Commented Feb 13, 2019 at 10:36
  • Check similar issue discussed here Android Studio CMake/Ninja Not Used for Building an NDK project Commented Feb 14, 2019 at 1:55

2 Answers 2

9

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
...
Sign up to request clarification or add additional context in comments.

2 Comments

cmake.dir not helpful for me, "uninstalled cmake 3.10 " save me.
Removing folder "..../Sdk/platform-tools/cmake/3.10.2.4988404" helped me.
3

I have solve the problem by add ninja to Path.

/Users/fish/Library/Android/sdk/cmake/3.10.2.4988404/bin

2 Comments

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
@chefish What does it mean "add ninja to Path" ? Where can I find this 'Path'? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.