在 Android Studio 中计算 CMake 服务器结果时出错 [英] Error computing CMake server result in Android Studio

查看:42
本文介绍了在 Android Studio 中计算 CMake 服务器结果时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android Studio 中,尝试构建我的项目时出现以下错误:

In Android Studio I'm getting the following error when attempting to build my project:

Error computing CMake server result.
Check for working C compiler: /Users/donturner/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
Check for working C compiler: /Users/donturner/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /Users/donturner/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
Check for working CXX compiler: /Users/donturner/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Configuring done

是什么导致了这个错误,我该如何解决?

What is causing this error and how can I resolve it?

推荐答案

Android Studio 很好地隐藏了此错误的根本原因.要找到它,您需要打开构建视图(视图->工具窗口->构建).现在点击切换窗口"按钮,如下所示:

Android Studio hides the root cause of this error pretty well. To find it you need to open the Build view (View->Tool windows->Build). Now click on the "Toggle windows" button which looks like this:

您现在应该看到此问题的根本原因.就我而言,它是:

You should now see the root cause of this problem. In my case it was:

CMake 错误在/Users/donturner/Code/workspace-android/io-2019-sonic-boom/SonicBoomApp/app/src/main/cpp/CMakeLists.txt:4(add_library):找不到源文件:

CMake Error at /Users/donturner/Code/workspace-android/io-2019-sonic-boom/SonicBoomApp/app/src/main/cpp/CMakeLists.txt:4 (add_library): Cannot find source file:

src/main/cpp/native-lib.cpp

尝试扩展 .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm.hpp .hxx .in .txx 无法计算构建系统.

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Failed to compute build system.

FAILURE:构建失败,出现异常.

FAILURE: Build failed with an exception.

我的源文件路径不正确 - 一旦您知道问题所在,就可以轻松解决.

I had an incorrect path to my source file - an easy fix once you know what the problem is.

这篇关于在 Android Studio 中计算 CMake 服务器结果时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆