1、将文件复制到项目中,导入文件的目录为app->libs。
2、右键点击jar文件,并点击“Add As Library”,将jar文件作为类库添加到项目中,最后选择指定的类库。
3、so文件:打开app目录下的build.gradle文件,在Android{}中加入如下代码:
packagingOptions { exclude ‘lib/armeabi/libBaiduMapSDK_map_v6_3_0.so‘ exclude ‘lib/armeabi/libBaiduMapSDK_base_v6_3_0.so‘ exclude ‘lib/armeabi/liblocSDK8a.so‘ } /*.so文件的引入进行配置*/ task nativeLibsToJar(type: Zip, description: "create a jar archive of the native libs") { destinationDir file("$projectDir/libs") baseName " So_Libs" extension "jar" from fileTree(dir: "libs", include: "**/*.so") into "lib" } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn(nativeLibsToJar) }
运行完毕,生成So_Libs.jar文件,导入成功。