遇到如下的错误应该如何解决。亲测可用:
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类中添加一个这样的方法
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
如下图所示
这样就可以编译成功了