title: Android Studio - CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set
body: <p>I'm going crazy with this error. I have tried searching and changing my code according to some suggestions that can be found in stackoverflow but still get the same error.
  I have downloaded CMake and there's Ninja in it. There's no LLDB.</p>
  <p><a href="https://i.stack.imgur.com/KcHuL.png" rel="nofollow noreferrer">My Ninja's path inside CMake</a></p>
  <p><a href="https://i.stack.imgur.com/npZzQ.png" rel="nofollow noreferrer">My Android Studio SDK Tools</a></p>
  <p>Here's the build.gradle. The comments are what I've tried</p>
  <pre><code>android {
      compileSdkVersion 27
      defaultConfig {
          applicationId &quot;com.example.opencv&quot;
          minSdkVersion 21
          targetSdkVersion 27
          ...
          externalNativeBuild {
              cmake {
                  cppFlags &quot;&quot;
                  //cppFlags &quot;-frtti -fexceptions&quot;
  //                arguments &quot;-DOpenCV_DIR=&quot; + project(':opencv').projectDir + &quot;/native/jni&quot;,
  //                        &quot;-DANDROID_STL=c++_shared&quot;,
  //                        &quot;-DANDROID_TOOLCHAIN=clang&quot;
                  //cppFlags &quot;-std=c++11 -frtti -fexceptions&quot;
                  //arguments &quot;-DANDROID_STL=c++_shared&quot;
                  //abiFilters 'armeabi-v7a','arm64-v8a'
                  arguments &quot;-GAndroid Gradle - Ninja&quot;
              }
          }
  //        ndk {
  //            moduleName &quot;native-lib&quot;
  //            abiFilters &quot;x86&quot;, &quot;x86_64&quot;, &quot;armeabi-v7a&quot;, &quot;arm64-v8a&quot;
  //        }
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      externalNativeBuild {
          cmake {
              path &quot;src/main/cpp/CMakeLists.txt&quot;
              version &quot;3.10.2&quot;
          }
      }
  }
  
  dependencies {
      ...
  }
  </code></pre>
  <p>Here's the stacktrace:</p>
  <pre><code>D:\Android_OCR\OpenCVTesseractOcr-master&gt;gradlew build --stacktrace
  
  &gt; Configure project :app
  Support for CMake 3.7 and higher is a preview feature. To report a bug, see https://developer.android.com/studio/report-bugs.html
  Support for CMake 3.7 and higher is a preview feature. To report a bug, see https://developer.android.com/studio/report-bugs.html
  
  &gt; Task :app:generateJsonModelDebug FAILED
  External native generate JSON debug: starting JSON generation
  External native generate JSON debug: using platform version 21 for ABI ARMEABI_V7A and min SDK version 21
  External native generate JSON debug: rebuilding JSON D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json due to:
  External native generate JSON debug: - expected json D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json file is not pre
  sent, will remove stale json folder
  External native generate JSON debug: - missing previous command file D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\armeabi-v7a\cmake_build_command.txt,
  will remove stale json folder
  External native generate JSON debug: removing stale contents from 'D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\armeabi-v7a'
  External native generate JSON debug: created folder 'D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\armeabi-v7a'
  External native generate JSON debug: executing cmake Executable : D:\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe
  arguments :
  -HD:\Android_OCR\OpenCVTesseractOcr-master\app\src\main\cpp
  -BD:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\armeabi-v7a
  -DANDROID_ABI=armeabi-v7a
  -DANDROID_PLATFORM=android-21
  -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\Android_OCR\OpenCVTesseractOcr-master\app\build\intermediates\cmake\debug\obj\armeabi-v7a
  -DCMAKE_BUILD_TYPE=Debug
  -DANDROID_NDK=D:\Android\sdk\ndk\21.3.6528147
  -DCMAKE_CXX_FLAGS=
  -DCMAKE_SYSTEM_NAME=Android
  -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a
  -DCMAKE_SYSTEM_VERSION=21
  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
  -DCMAKE_ANDROID_NDK=D:\Android\sdk\ndk\21.3.6528147
  -DCMAKE_TOOLCHAIN_FILE=D:\Android\sdk\ndk\21.3.6528147\build\cmake\android.toolchain.cmake
  -G Ninja
  -GAndroid Gradle - Ninja
  jvmArgs :
  
  
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;supportedProtocolVersions&quot;:[{&quot;isExperimental&quot;:true,&quot;major&quot;:1,&quot;minor&quot;:1}],&quot;type&quot;:&quot;hello&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  [== &quot;CMake Server&quot; ==[
  
  {
    &quot;type&quot;: &quot;handshake&quot;,
    &quot;cookie&quot;: &quot;gradle-cmake-cookie&quot;,
    &quot;protocolVersion&quot;: {
      &quot;isExperimental&quot;: true,
      &quot;major&quot;: 1,
      &quot;minor&quot;: 1
    },
    &quot;sourceDirectory&quot;: &quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/src/main/cpp&quot;,
    &quot;buildDirectory&quot;: &quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armeabi-v7a&quot;,
    &quot;generator&quot;: &quot;Ninja&quot;
  }
  
  ]== &quot;CMake Server&quot; ==]
  
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;gradle-cmake-cookie&quot;,&quot;inReplyTo&quot;:&quot;handshake&quot;,&quot;type&quot;:&quot;reply&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  [== &quot;CMake Server&quot; ==[
  
  {
    &quot;type&quot;: &quot;configure&quot;,
    &quot;cacheArguments&quot;: [
      &quot;&quot;,
      &quot;-DANDROID_ABI\u003darmeabi-v7a&quot;,
      &quot;-DANDROID_PLATFORM\u003dandroid-21&quot;,
      &quot;-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003dD:\\Android_OCR\\OpenCVTesseractOcr-master\\app\\build\\intermediates\\cmake\\debug\\obj\\armeabi-v7a&quot;,
      &quot;-DCMAKE_BUILD_TYPE\u003dDebug&quot;,
      &quot;-DANDROID_NDK\u003dD:\\Android\\sdk\\ndk\\21.3.6528147&quot;,
      &quot;-DCMAKE_CXX_FLAGS\u003d&quot;,
      &quot;-DCMAKE_SYSTEM_NAME\u003dAndroid&quot;,
      &quot;-DCMAKE_ANDROID_ARCH_ABI\u003darmeabi-v7a&quot;,
      &quot;-DCMAKE_SYSTEM_VERSION\u003d21&quot;,
      &quot;-DCMAKE_EXPORT_COMPILE_COMMANDS\u003dON&quot;,
      &quot;-DCMAKE_ANDROID_NDK\u003dD:\\Android\\sdk\\ndk\\21.3.6528147&quot;,
      &quot;-DCMAKE_TOOLCHAIN_FILE\u003dD:\\Android\\sdk\\ndk\\21.3.6528147\\build\\cmake\\android.toolchain.cmake&quot;,
      &quot;-G Ninja&quot;,
      &quot;-GAndroid Gradle - Ninja&quot;
    ]
  }
  
  ]== &quot;CMake Server&quot; ==]
  
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;message&quot;:&quot;CMake Error: CMake was unable to find a build program corresponding to \&quot;Ninja\&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to
  select a different build tool.&quot;,&quot;title&quot;:&quot;Error&quot;,&quot;type&quot;:&quot;message&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  CMake Error: CMake was unable to find a build program corresponding to &quot;Ninja&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  CMake Error: CMake was unable to find a build program corresponding to &quot;Ninja&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;progressCurrent&quot;:1000,&quot;progressMaximum&quot;:1000,&quot;progressMessage&quot;:&quot;Configuring&quot;,&quot;progressMinimum&quot;:0,&quot;type&quot;:&quot;progress&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;message&quot;:&quot;Configuring incomplete, errors occurred!\nSee also \&quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armea
  bi-v7a/CMakeFiles/CMakeOutput.log\&quot;.&quot;,&quot;type&quot;:&quot;message&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  Configuring incomplete, errors occurred!
  See also &quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log&quot;.
  Configuring incomplete, errors occurred!
  See also &quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log&quot;.
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;errorMessage&quot;:&quot;Configuration failed.&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;type&quot;:&quot;error&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  Configuration failed.
  External native generate JSON debug: using platform version 21 for ABI ARM64_V8A and min SDK version 21
  External native generate JSON debug: rebuilding JSON D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\arm64-v8a\android_gradle_build.json due to:
  External native generate JSON debug: - expected json D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\arm64-v8a\android_gradle_build.json file is not prese
  nt, will remove stale json folder
  External native generate JSON debug: - missing previous command file D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\arm64-v8a\cmake_build_command.txt, wi
  ll remove stale json folder
  External native generate JSON debug: removing stale contents from 'D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\arm64-v8a'
  External native generate JSON debug: created folder 'D:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\arm64-v8a'
  External native generate JSON debug: executing cmake Executable : D:\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe
  arguments :
  -HD:\Android_OCR\OpenCVTesseractOcr-master\app\src\main\cpp
  -BD:\Android_OCR\OpenCVTesseractOcr-master\app\.externalNativeBuild\cmake\debug\arm64-v8a
  
  
  
  
  
  ... *[I cut it. Too much stacktrace and it's looping]*
  
  
  
  
  
  
  ]== &quot;CMake Server&quot; ==]
  
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;message&quot;:&quot;CMake Error: CMake was unable to find a build program corresponding to \&quot;Ninja\&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to
  select a different build tool.&quot;,&quot;title&quot;:&quot;Error&quot;,&quot;type&quot;:&quot;message&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  CMake Error: CMake was unable to find a build program corresponding to &quot;Ninja&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  CMake Error: CMake was unable to find a build program corresponding to &quot;Ninja&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;progressCurrent&quot;:1000,&quot;progressMaximum&quot;:1000,&quot;progressMessage&quot;:&quot;Configuring&quot;,&quot;progressMinimum&quot;:0,&quot;type&quot;:&quot;progress&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;message&quot;:&quot;Configuring incomplete, errors occurred!\nSee also \&quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/x86_6
  4/CMakeFiles/CMakeOutput.log\&quot;.&quot;,&quot;type&quot;:&quot;message&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  Configuring incomplete, errors occurred!
  See also &quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/x86_64/CMakeFiles/CMakeOutput.log&quot;.
  Configuring incomplete, errors occurred!
  See also &quot;D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/x86_64/CMakeFiles/CMakeOutput.log&quot;.
  
  
  [== &quot;CMake Server&quot; ==[
  
  {&quot;cookie&quot;:&quot;&quot;,&quot;errorMessage&quot;:&quot;Configuration failed.&quot;,&quot;inReplyTo&quot;:&quot;configure&quot;,&quot;type&quot;:&quot;error&quot;}
  
  ]== &quot;CMake Server&quot; ==]
  
  Configuration failed.
  External native generate JSON debug: JSON generation completed with problems
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:generateJsonModelDebug'.
  &gt; com.android.ide.common.process.ProcessException: Error configuring
  
  * Try:
  Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Exception is:
  org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateJsonModelDebug'.
          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
          at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
          at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
          at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
          at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
          at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
          at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
          at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
          at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
          at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
          at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
          at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
          at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
          at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
          at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
          at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
          at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:262)
          at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:246)
          at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:136)
          at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
          at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.execute(DefaultTaskPlanExecutor.java:201)
          at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.executeWithTask(DefaultTaskPlanExecutor.java:192)
          at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
          at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:74)
          at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:131)
          at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
          at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
          at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
          at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
          at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
          at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
          at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
          at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:343)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
          at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
          at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:212)
          at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:140)
          at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:115)
          at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:77)
          at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:74)
          at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
          at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:38)
          at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
          at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:74)
          at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
          at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
          at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
          at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:47)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
          at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
          at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:43)
          at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
          at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:65)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
          at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
          at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
          at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
          at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
          at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
          at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
          at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
          at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
          at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
          at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
          at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
          at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
          at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
          at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
          at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
          at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
          at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
          at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
          at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
          at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
          at org.gradle.util.Swapper.swap(Swapper.java:38)
          at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
          at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
          at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
          at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
          at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
          at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
          at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
          at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
          at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
  Caused by: org.gradle.internal.UncheckedException: com.android.ide.common.process.ProcessException: Error configuring
          at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
          at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
          at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
          at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
          at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
          at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
          at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:794)
          at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:761)
          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
          at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
          at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
          ... 110 more
  Caused by: com.android.ide.common.process.ProcessException: Error configuring
          at com.android.build.gradle.tasks.CmakeServerExternalNativeJsonGenerator.executeProcessAndGetOutput(CmakeServerExternalNativeJsonGenerator.java:198)
          at com.android.build.gradle.tasks.CmakeExternalNativeJsonGenerator.executeProcess(CmakeExternalNativeJsonGenerator.java:126)
          at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.buildAndPropagateException(ExternalNativeJsonGenerator.java:323)
          at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.build(ExternalNativeJsonGenerator.java:188)
          at com.android.build.gradle.tasks.ExternalNativeBuildJsonTask.build(ExternalNativeBuildJsonTask.java:35)
          at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
          ... 123 more
  
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 7s
  23 actionable tasks: 23 executed
  </code></pre>
  <p>--- EDIT CMakeList.txt ---
  [Sorry. Turns out I deleted too much because of the limit...]</p>
  <p>And here's CMakeList.txt</p>
  <pre><code>cmake_minimum_required(VERSION 3.4.1)
  
  
  add_library( # Sets the name of the library.
               native-lib
  
               # Sets the library as a shared library.
               SHARED
  
               # Provides a relative path to your source file(s).
               src/main/cpp/native-lib.cpp )
  
  
  find_library( # Sets the name of the path variable.
                log-lib
  
                # Specifies the name of the NDK library that
                # you want CMake to locate.
                log )
  
  # Specifies libraries CMake should link to your target library. You
  # can link multiple libraries, such as libraries you define in this
  # build script, prebuilt third-party libraries, or system libraries.
  
  target_link_libraries( # Specifies the target library.
                         native-lib
  
                         # Links the target library to the log library
                         # included in the NDK.
                         ${log-lib} )
  </code></pre>
  <p>Am I missing something?
  I really appreciate your help.</p>