Android studio 添加JNI后报错

Error:Execution failed for task ':app: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.html
or use the experimental plugin:

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


第一种方式是用CMAKE的编译方式。

第二种是还是用ndk编译

主要记录下第二种方式:

1.修改工程build.gradle文件

classpath 'com.android.tools.build:gradle:2.3.0'

2.修改项目build.gradle文件

ndk {
    moduleName "led"
    ldLibs "log", "z", "m"
    abiFilters "armeabi-v7a", "x86"
}
3.项目添加文件gradle.properties
 
  
android.useDeprecatedNdk=true
4.Jni目录放到Main文件下面。

你可能感兴趣的:(Android studio 添加JNI后报错)