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

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

2017-05-08 19:45 671 查看
遇到如下的错误应该如何解决。亲测可用:

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.

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

如图: 


 

然后再在文件build.gradle(Module:app)里面的buildTypes类中添加一个这样的方法
sourceSets {
main {
jni.srcDirs = []
}
}
1
2
3
4
5
1
2
3
4
5

如下图所示 


 

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