android-studio - 在 Android Studio 中计算 CMake 服务器结果时出错

标签 android-studio android-ndk

在 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 ->工具窗口->构建)。现在单击“切换窗口”按钮,如下所示:

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

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/

相关文章:

java - 在应用程序模块 Android 库模块中使用带有 JNI 的库模块

android - 组织.gradle.api.tasks.TaskExecutionException : Execution failed for task ':mergeDevOnlySlDebugResources' only on Jenkins

java - Android Studio : android.intent.category.LAUNCHER 客户端尚未准备好

java - 找不到ID为 'Android'的插件

android-studio - android studios/gradle 同步启动时多个重复​​的 Openjdk 二进制文件失败,96% RAM

android - 信号 11 (SIGSEGV)、代码 1 (SEGV_MAPERR) 仅在某些设备上崩溃

c++ - NDK不能用来做什么?

android - 运行从互联网下载的 native 库

android - 在 Android Studio 中为 android 应用程序设置开发和生产环境

android - NDK 构建失败 cocos2d-x