解决Your project contains C++ files but it is not using a supported native build system
来源:互联网 发布:职场色诱 知乎 编辑:程序博客网 时间:2024/06/05 10:12
学习ndk开发,使用android studio2.3写的第一个项目,hello world,build时报错如下:
Error:Execution failed for task ':libtermexec:compileReleaseNdk'.> 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:https://developer.android.com/studio/projects/add-native-code.htmlor use the experimental plugin:https://developer.android.com/studio/build/experimental-plugin.html.
在网上找了N久,发现下面这个方法不行,暂且称这个为方法1,步骤如下:
原文链接
一、在项目的gradle.properties添加
android.useDeprecatedNdk=true//这句话的意思应该是使用废弃的ndk
二、在module的build.gradle(Module:app)的buildTypes同级添加sourceSets属性
sourceSets { main { //原文为jni.srcDirs = [],但是发现使用[]时,as运行卡顿,修改为''恢复, //另外,建议这里直接使用'libs'目录,因为当使用其他包有.so文件时,一般习惯也是直接拷贝进入libs目录(比如百度地图的.so文件) jni.srcDirs 'libs' }}buildTypes{}
方法应该只是解决了找不到jnilibs的问题,我试过不能解决我的问题,可能我的as和百度上的答案as版本不一致
上google,发现如下方法有效(吐槽一下,google上大部分也是说的方法1):
原文链接
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: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 projecta. If you selected CMake, specify the CMakeLists.txt script in your projectb. If you selected ndk-build, specify the Android.mk.
在按照这个方法配置后,as可以自动编译,生成的文件位于module/src/main/obj目录下
附上官方文档
这件事情给了一个教训,只要是正经事,不管查什么,先上google,百度可以查到的,google都有,而且,google会优先给你更好的
另外,android官方文档的中文翻译貌似不怎么样,其中有些东西有较为明显的误导,阅读时注意甄别,或者中英文同时阅读(使用双浏览器,不然需要不停的更换语言)
阅读全文
0 0
- 解决Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system
- Your project contains C++ files but it is not using a supported native build system.
- Error: Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system.
- Error: Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system
- Your project contains C++ files but it is not using a supported native build system
- Error: Your project contains C++ files but it is not using a supported native build system.
- [笔记]如何解决Your project contains C++ files but it is not using a supported native build system
- Eclipse项目转AndroidStudio报错:Your project contains C++ files but it is not using a supported native...
- compileDebugNdk'. > Error: Your project contains C++ files but it is not using a supported nati
- Your account already has a signing certificate for this machine but it is not present in your keycha
- DBMS is not supported in your current installation解决
- Reflow和Repaint的基本认识和优化
- 二叉树的深度
- 61. Rotate List
- 【亲测】win 10下使用conda安装环境,进行flask web开发
- C++调用Object-C
- 解决Your project contains C++ files but it is not using a supported native build system
- 国家常用代号 for Mysql数据库
- 欢迎使用CSDN-markdown编辑器
- 二分查找的递归和非递归实现
- 如何使用ajax传递字符串数组
- JavaEE软件开发体系架构
- android studio 多渠道打包
- windows install mariadb(zip)
- phpStudy刚启动之后Apache就掉线停了