在Android Studio中错误计算CMake服务器结果 [英] Error computing CMake server result in Android Studio
问题描述
在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: 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屋!