错误:您的项目包含 C++ 文件,但未使用受支持的本机构建 [英] Error: Your project contains C++ files but it is not using a supported native build

查看:30
本文介绍了错误:您的项目包含 C++ 文件,但未使用受支持的本机构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:任务: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:

  1. 在您的项目窗格中,右键单击您的模块,然后选择链接使用 Gradle 的 C++ 项目.
  2. 下拉中选择CMakendk-build,具体取决于您的项目

  1. In your project pane, right-click on your module, and select Link C++ Project with Gradle.
  2. 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屋!

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