错误:您的项目包含 C++ 文件,但未使用受支持的本机构建 [英] Error: Your project contains C++ files but it is not using a supported native build
问题描述
错误:任务:app:compileDebugNdk"的执行失败.
Error:Execution failed for task ':app:compileDebugNdk'.
错误:您的项目包含 C++ 文件,但未使用受支持的本机构建系统.考虑使用 CMake 或 ndk-build 与稳定的 Android Gradle 插件集成:
Error: Your project contains C++ files but it is not using a supported native build system. Consider using CMake or ndk-build integration with the stable Android Gradle plugin:
推荐答案
您似乎已经有了 C++ 代码和项目目录中的 Makefile,在这种情况下,您只需要将 Gradle 链接到本机库:
It seems that you already have the C++ code, and the Makefiles in the project directory, in which case, you simply have to link Gradle to the native library:
- 在您的项目窗格中,右键单击您的模块,然后选择链接使用 Gradle 的 C++ 项目.
从下拉中选择CMake或ndk-build,具体取决于您的项目
- In your project pane, right-click on your module, and select Link C++ Project with Gradle.
From the drop-down select either CMake or ndk-build, depending on your project
一个.如果您选择了 CMake,请在您的项目中指定 CMakeLists.txt 脚本
a. If you selected CMake, specify the CMakeLists.txt script in your project
B.如果您选择了 ndk-build,请指定 Android.mk.
b. If you selected ndk-build, specify the Android.mk.
来源: https://developer.android.com/studio/projects/add-native-code.html#existing-project
这篇关于错误:您的项目包含 C++ 文件,但未使用受支持的本机构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!