Android Spatialite中jsqlite.Database.internal_init中的java.lang.UnsatisfiedLinkError [英] java.lang.UnsatisfiedLinkError in jsqlite.Database.internal_init in Android Spatialite
问题描述
我是Android开发和使用Spatialite的新手,却无法弄清为什么我的应用由于以下错误而在少数设备上崩溃:
I'm new to developing for Android and using Spatialite and can't figure out why my app is crashing on a few devices because of this error:
java.lang.UnsatisfiedLinkError:找不到无效的jsqlite.Database.internal_init()的实现(尝试Java_jsqlite_Database_internal_1init和Java_jsqlite_Database_internal_1init__) 在jsqlite.Database.internal_init(本机方法) 在jsqlite.Database.(Database.java:25)
java.lang.UnsatisfiedLinkError: No implementation found for void jsqlite.Database.internal_init() (tried Java_jsqlite_Database_internal_1init and Java_jsqlite_Database_internal_1init__) at jsqlite.Database.internal_init(Native Method) at jsqlite.Database.(Database.java:25)
此崩溃报告来自具有Android 6.0的Nexus 5(锤头),但已在具有Android 4.1和其他一些未知设备的Xoom上进行了报告.我认为这可能与这些问题中提到的NDK版本有关:
This crash report is from a Nexus 5 (hammerhead) with Android 6.0 but it's been reported on Xoom with Android 4.1 and a few other unknown devices. I think it maybe be related to NDK versions as mentioned in these issues:
添加".so"库到我的android studio项目中
Android NDK java.lang.UnsatisfiedLinkError:findLibrary返回null
https://bitbucket.org/almworks/sqlite4java/issues/71/arm64-位. (尽管这是针对sqlite4java的)
Adding ".so" library to my android studio project
Android NDK java.lang.UnsatisfiedLinkError: findLibrary returned null
https://bitbucket.org/almworks/sqlite4java/issues/71/arm64-bit. (although this is for sqlite4java)
除此之外,我还收到此错误/警告(取决于设备):libjsqlite.so具有文本重定位.这浪费了内存并阻止了安全性强化.请修复.尽管它不会像其他错误一样使应用程序崩溃.
Other than that I'm also getting this error/warning (depending on the device): libjsqlite.so has text relocations. This is wasting memory and prevents security hardening. Please fix. Although it doesnt crash the app like the other error.
推荐答案
我通过在应用程序built.gradle
(或AndroidManifest.xml中)中对此进行设置来解决了这个问题:
I solved it by setting in the app built.gradle
(or in the AndroidManifest.xml) this:
targetSdkVersion 21
它有效! 我知道这不是一个好的解决方案,它是一个补丁,但是我可以工作!
And it works! I know that it isn't a good solution, it's a patch, but i works!
***更新
如果无法将目标版本更改为21,则可以执行以下操作:
If you can't change the target version to 21, you can do the following:
- 从以下位置下载源代码: https://github.com/geopaparazzi/geopaparazzi
- 将项目中的所有引用清理为spacespaceite,.war文件和jndi库
- 复制模块
geopaparazzispatialitelibrary
并集成到您的项目中 - 从模块中清除不需要的代码
- 编译并享受您的项目定位版本23
- Download the source code from:https://github.com/geopaparazzi/geopaparazzi
- Clean all references in your project to spatialite, .war file, and jndi libraries
- Copy module
geopaparazzispatialitelibrary
and integrate in your project - Clean the code that you don't need from the module
- Compile, and enjoy your project targeting version 23
这是一个有点复杂的过程,但是可以.
It's a bit complex process, but it works.
特别感谢安德里亚·安东内洛,他帮助我解决了这个问题,并在spacespaceite方面做得很好.
Expecially thanks to andrea antonello, he help me to solve the problem, and do a great job with spatialite.
这篇关于Android Spatialite中jsqlite.Database.internal_init中的java.lang.UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!