在 Android Studio 中,尝试构建我的项目时出现以下错误:
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
是什么导致了这个错误,我该如何解决?
最佳答案
Android Studio 很好地隐藏了此错误的根本原因。要找到它,您需要打开构建 View ( View ->工具窗口->构建)。现在单击“切换窗口”按钮,如下所示:
您现在应该看到此问题的根本原因。就我而言,它是:
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
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.
我的源文件路径不正确 - 一旦您知道问题所在,就可以轻松解决。
关于android-studio - 在 Android Studio 中计算 CMake 服务器结果时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55476461/