方法一:
将libs文件夹下的so文件,通过gradle配置任务编译成jar文件。
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‘]) }
参考资料:http://blog.csdn.net/wulianghuan/article/details/44567001
时间: 2024-10-13 01:05:14