出错的地方是在:
<span style="font-size:24px;"> static {
try {
System.loadLibrary("locSDK5");
} catch (UnsatisfiedLinkError var1) {
var1.printStackTrace();
af = true;
throw new IllegalStateException("no found the liblocSDK4d.so file, please correct settings");
}
}</span>
Jni调用时出错的。该代码在eclipse上运行时没有问题的,但是到android studio上就会报 no found the liblocSDK4d.so file, please correct settings异常。原因是找不到locaSDK5..但是我们明明添加了liblocalSDk5文件,为什么会搜索不到呢?解决方法如下:
1.检查localSDK5.so是否在armeabi文件夹下
2.就是我们最容易忽视的地方build.gradle文件
<span style="font-size:24px;"> sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}</span>
确定是否配置了jni的调用地址。
希望对读者有一定的帮助,有什么问题可随时跟我留言。谢谢