1.在工程下新建 jni/libs 文件夹 , jni 是和原来的libs 同级 ,将所有的.so文件放入 新建的libs文件下
2.在build.gradle 文件中新增以下内容到android{ } 下
task copyNativeLibs(type: Copy) {
from(new File(project(‘:HealthCare‘).getProjectDir(), ‘libs‘)) { include ‘**/*.so‘ }
into new File(buildDir, ‘native-libs‘)
}
tasks.withType(Compile) {
compileTask -> compileTask.dependsOn copyNativeLibs
clean.dependsOn ‘cleanCopyNativeLibs‘
tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
pkgTask ->
pkgTask.jniFolders = new HashSet<File>()
pkgTask.jniFolders.add(new File(buildDir, ‘native-libs‘))
******************************************
更多交流就在Q群 107584987
Coding Your Life