一、jar包引用
1、位置:放在libs目录下,右键add as Libray
2、jar包的里的class使用import引用
二、so库的使用
1、编译发现少so库,如下
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/项目包名-2/base.apk", zip file "/data/app/项目包名-2/split_lib_dependencies_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_0_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_1_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_2_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_3_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_4_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_5_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_6_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_7_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_8_apk.apk", zip file "/data/app/项目包名-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/项目包名-2/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libhdtk_socket.so"
2、jar包的一个文件里有这个加载netio库的操作
static {
System.loadLibrary("netio");
}
3、将so库放在什么位置?
百度有各种在build.gradle里改的,不是很明白,先直接放到如下图目录,可以正常使用
详解Android Studio如何导入第三方类库、jar包和so库_Android_脚本之家
学习源码编译so库的链接:Android Studio NDK JNI配置Demo超详细2016_gzjck的博客-CSDN博客