android新项目导入后进行编译出现cmake错误

发布于 2022-09-11 18:38:21 字数 13124 浏览 49 评论 0

问题描述

使用as加载并且gradle sync 提示:SIMPLE:error configure
图片描述
同时使用make project
提示
图片描述

问题出现的环境背景及自己尝试过哪些方法

已经尝试更换过ndk 调整target brinary 然后完全clean project等操作

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)
使用gradlew build --stacktrace命令 出现以下问题

PS D:\EagleEye2.0> .\gradlew build --stacktrace
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

> 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 19 for ABI ARMEABI_V7A and min SDK version 19
External native generate JSON debug: rebuilding JSON D:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json due to:
External native generate JSON debug: - expected json D:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a\android_gradle_build.json file is not present, will remove stale json folder
External native generate JSON debug: - missing previous command file D:\EagleEye2.0\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:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a'
External native generate JSON debug: created folder 'D:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a'
External native generate JSON debug: executing cmake Executable : D:\Androidsdk\cmake\3.10.2.4988404\bin\cmake.exe
arguments :
-HD:\EagleEye2.0\app
-BD:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a
-DANDROID_ABI=armeabi-v7a
-DANDROID_PLATFORM=android-19
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\EagleEye2.0\app\build\intermediates\cmake\debug\obj\armeabi-v7a
-DCMAKE_BUILD_TYPE=Debug
-DANDROID_NDK=D:\Androidsdk\android-ndk-r14b
-DCMAKE_CXX_FLAGS=-std=c++11 -frtti -fexceptions
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a
-DCMAKE_SYSTEM_VERSION=19
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_ANDROID_NDK=D:\Androidsdk\android-ndk-r14b
-DCMAKE_TOOLCHAIN_FILE=D:\EagleEye2.0\app\.externalNativeBuild\cmake\debug\armeabi-v7a\pre-ndk-r15-wrapper-android.toolchain.cmake
-G Ninja
-DANDROID_ARM_NEON=TRUE
-DANDROID_TOOLCHAIN=clang
-DCMAKE_BUILD_TYPE=Release
-DANDROID_TOOLCHAIN=clang
-DANDROID_STL=gnustl_static
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:/EagleEye2.0/app",
  "buildDirectory": "D:/EagleEye2.0/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-19",
    "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY\u003dD:\\EagleEye2.0\\app\\build\\intermediates\\cmake\\debug\\obj\\armeabi-v7a",
    "-DCMAKE_BUILD_TYPE\u003dDebug",
    "-DANDROID_NDK\u003dD:\\Androidsdk\\android-ndk-r14b",
    "-DCMAKE_CXX_FLAGS\u003d-std\u003dc++11 -frtti -fexceptions",
    "-DCMAKE_SYSTEM_NAME\u003dAndroid",
    "-DCMAKE_ANDROID_ARCH_ABI\u003darmeabi-v7a",
    "-DCMAKE_SYSTEM_VERSION\u003d19",
    "-DCMAKE_EXPORT_COMPILE_COMMANDS\u003dON",
    "-DCMAKE_ANDROID_NDK\u003dD:\\Androidsdk\\android-ndk-r14b",
    "-DCMAKE_TOOLCHAIN_FILE\u003dD:\\EagleEye2.0\\app\\.externalNativeBuild\\cmake\\debug\\armeabi-v7a\\pre-ndk-r15-wrapper-android.toolchain.cmake",
    "-G Ninja",
    "-DANDROID_ARM_NEON\u003dTRUE",
    "-DANDROID_TOOLCHAIN\u003dclang",
    "-DCMAKE_BUILD_TYPE\u003dRelease",
    "-DANDROID_TOOLCHAIN\u003dclang",
    "-DANDROID_STL\u003dgnustl_static"
  ]
}

]== "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:/EagleEye2.0/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log\".","type":"message"}

]== "CMake Server" ==]

Configuring incomplete, errors occurred!
See also "D:/EagleEye2.0/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
Configuring incomplete, errors occurred!
See also "D:/EagleEye2.0/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: 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:100)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        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.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        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:780)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
        ... 29 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)
        ... 41 more


* Get more help at https://help.gradle.org

BUILD FAILED in 6s
23 actionable tasks: 10 executed, 13 up-to-date

你期待的结果是什么?实际看到的错误信息又是什么?

只要能够成功打包apk并运行就行了.....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜警司 2022-09-18 18:38:21

结案了 查找cmake log之后发现cmake cannot find the build tool "ninja" 安装ninja 结案

三岁铭 2022-09-18 18:38:21

请问这个问题解决了吗。求分享。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文