gpt4 book ai didi

Android Studio - CMake 错误 : CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM 未设置

转载 作者:行者123 更新时间:2023-12-03 20:50:00 27 4
gpt4 key购买 nike

我要为这个错误发疯。我已经尝试根据可以在 stackoverflow 中找到的一些建议搜索和更改我的代码,但仍然得到相同的错误。
我已经下载了 CMake,里面有 Ninja。没有LLDB。
My Ninja's path inside CMake
My Android Studio SDK Tools
这是 build.gradle。评论是我尝试过的

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.opencv"
minSdkVersion 21
targetSdkVersion 27
...
externalNativeBuild {
cmake {
cppFlags ""
//cppFlags "-frtti -fexceptions"
// arguments "-DOpenCV_DIR=" + project(':opencv').projectDir + "/native/jni",
// "-DANDROID_STL=c++_shared",
// "-DANDROID_TOOLCHAIN=clang"
//cppFlags "-std=c++11 -frtti -fexceptions"
//arguments "-DANDROID_STL=c++_shared"
//abiFilters 'armeabi-v7a','arm64-v8a'
arguments "-GAndroid Gradle - Ninja"
}
}
// ndk {
// moduleName "native-lib"
// abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
}
}
}

dependencies {
...
}
这是堆栈跟踪:
D:\Android_OCR\OpenCVTesseractOcr-master>gradlew build --stacktrace

> 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

> 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 :




[== "CMake Server" ==[

{"supportedProtocolVersions":[{"isExperimental":true,"major":1,"minor":1}],"type":"hello"}

]== "CMake Server" ==]

[== "CMake Server" ==[

{
"type": "handshake",
"cookie": "gradle-cmake-cookie",
"protocolVersion": {
"isExperimental": true,
"major": 1,
"minor": 1
},
"sourceDirectory": "D:/Android_OCR/OpenCVTesseractOcr-master/app/src/main/cpp",
"buildDirectory": "D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armeabi-v7a",
"generator": "Ninja"
}

]== "CMake Server" ==]



[== "CMake Server" ==[

{"cookie":"gradle-cmake-cookie","inReplyTo":"handshake","type":"reply"}

]== "CMake Server" ==]

[== "CMake Server" ==[

{
"type": "configure",
"cacheArguments": [
"",
"-DANDROID_ABI\u003darmeabi-v7a",
"-DANDROID_PLATFORM\u003dandroid-21",
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003dD:\\Android_OCR\\OpenCVTesseractOcr-master\\app\\build\\intermediates\\cmake\\debug\\obj\\armeabi-v7a",
"-DCMAKE_BUILD_TYPE\u003dDebug",
"-DANDROID_NDK\u003dD:\\Android\\sdk\\ndk\\21.3.6528147",
"-DCMAKE_CXX_FLAGS\u003d",
"-DCMAKE_SYSTEM_NAME\u003dAndroid",
"-DCMAKE_ANDROID_ARCH_ABI\u003darmeabi-v7a",
"-DCMAKE_SYSTEM_VERSION\u003d21",
"-DCMAKE_EXPORT_COMPILE_COMMANDS\u003dON",
"-DCMAKE_ANDROID_NDK\u003dD:\\Android\\sdk\\ndk\\21.3.6528147",
"-DCMAKE_TOOLCHAIN_FILE\u003dD:\\Android\\sdk\\ndk\\21.3.6528147\\build\\cmake\\android.toolchain.cmake",
"-G Ninja",
"-GAndroid Gradle - Ninja"
]
}

]== "CMake Server" ==]



[== "CMake Server" ==[

{"cookie":"","inReplyTo":"configure","message":"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.","title":"Error","type":"message"}

]== "CMake Server" ==]

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


[== "CMake Server" ==[

{"cookie":"","inReplyTo":"configure","progressCurrent":1000,"progressMaximum":1000,"progressMessage":"Configuring","progressMinimum":0,"type":"progress"}

]== "CMake Server" ==]



[== "CMake Server" ==[

{"cookie":"","inReplyTo":"configure","message":"Configuring incomplete, errors occurred!\nSee also \"D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armea
bi-v7a/CMakeFiles/CMakeOutput.log\".","type":"message"}

]== "CMake Server" ==]

Configuring incomplete, errors occurred!
See also "D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
Configuring incomplete, errors occurred!
See also "D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".


[== "CMake Server" ==[

{"cookie":"","errorMessage":"Configuration failed.","inReplyTo":"configure","type":"error"}

]== "CMake Server" ==]

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]*






]== "CMake Server" ==]



[== "CMake Server" ==[

{"cookie":"","inReplyTo":"configure","message":"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.","title":"Error","type":"message"}

]== "CMake Server" ==]

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


[== "CMake Server" ==[

{"cookie":"","inReplyTo":"configure","progressCurrent":1000,"progressMaximum":1000,"progressMessage":"Configuring","progressMinimum":0,"type":"progress"}

]== "CMake Server" ==]



[== "CMake Server" ==[

{"cookie":"","inReplyTo":"configure","message":"Configuring incomplete, errors occurred!\nSee also \"D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/x86_6
4/CMakeFiles/CMakeOutput.log\".","type":"message"}

]== "CMake Server" ==]

Configuring incomplete, errors occurred!
See also "D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/x86_64/CMakeFiles/CMakeOutput.log".
Configuring incomplete, errors occurred!
See also "D:/Android_OCR/OpenCVTesseractOcr-master/app/.externalNativeBuild/cmake/debug/x86_64/CMakeFiles/CMakeOutput.log".


[== "CMake Server" ==[

{"cookie":"","errorMessage":"Configuration failed.","inReplyTo":"configure","type":"error"}

]== "CMake Server" ==]

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'.
> 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
--- 编辑 CMakeList.txt ---
[对不起。原来是因为限制我删的太多了...]
这是 CMakeList.txt
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} )
我错过了什么吗?
我真的很感谢你的帮助。

最佳答案

您的 CMake 文件看起来已被拆除;在这种状态下使用它不会成功构建任何东西。通常对于 NDK 项目,我已经看到模板 CMakeLists.txt 文件包含 native-lib 的 CMake 代码。和 log-lib图书馆。这个模板是一个很好的起点。
为了让你走到一半,考虑将你的 CMake 代码更改为以下内容,或者切换到使用 this 中列出的模板教程:

cmake_minimum_required(VERSION 3.4.1)

# Specify the 'native-lib' library
add_library(native-lib SHARED src/main/cpp/native-lib.cpp)

# Find the log NDK library.
find_library(log-lib log)

# Link the log library to the native-lib library.
target_link_libraries(native-lib ${log-lib})
我建议花一些时间熟悉 CMake,以及如何构建基本的 CMake 文件。 cmake 中的教程 tag info有很多有用的信息。

关于Android Studio - CMake 错误 : CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM 未设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63370422/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com