您的位置:首页 > 编程语言 > C语言/C++

Error: Your project contains C++ files but it is not using a supported native build system

2017-07-05 16:40 627 查看
我在导入android studio 代码的时候运行报错:

Error:Execution failed for task ':app:compileDebugNdk'.

> 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.html

or use the experimental plugin:
 https://developer.android.com/studio/build/experimental-plugin.html.

这个情况是项目中使用了NDK—jni导致的配置错误,看了别人的解决方法,我的问题也解决了:

首先在工程目录下的gradle.properties文件的末尾加上一句:Android.useDeprecatedNdk=true

如图:



然后再在文件build.gradle(Module:app)里面的buildTypes类中添加一个这样的方法

sourceSets {
main {
jni.srcDirs = []
}
}


如下图所示



这样就可以编译成功了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐