方法一:java
將libs文件夾下的so文件,經過gradle配置任務編譯成jar文件。android
apply plugin: 'com.android.library' android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion } /** 導入so文件 */ task nativeLibsToJar(type: Zip, description: "create a jar archive of the native libs") { destinationDir file("$projectDir/libs") baseName "Native_Libs2" extension "jar" from fileTree(dir: "libs", include: "**/*.so") into "lib" } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn(nativeLibsToJar) } } dependencies { provided fileTree(dir: 'libs', include: ['*.jar']) }
方法二:app
經過插件將so文件依賴到jniLibs文件夾。ide
方法三:gradle
最佳方法。ui
android { sourceSets.main.jniLibs.srcDirs = ['libs'] compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion } }
固然,開發完APP也是須要進行全方位的檢測:www.ineice.comspa