java.lang.UnsatisfiedLinkError in jsqlite.Database.internal_init in Android Spatialite

牧云@^-^@ 提交于 2019-12-01 20:52:18

问题


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: 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)

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:

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)

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.


回答1:


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!

***UPDATE

If you can't change the target version to 21, you can do the following:

  • 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.

Expecially thanks to andrea antonello, he help me to solve the problem, and do a great job with spatialite.




回答2:


In case this can help anyone with the same problem, I solved this by updating the jni libraries. To do this i downloaded this file:

https://github.com/geopaparazzi/libjsqlite-spatialite-android/blob/master/archive/20150616.libjsqlite.4.3.0.tar.bz2

from the geopaparazzi github repo which contains the latest version of the jni libraries as of now.

Replace the .so files in the spatialiteandroid library with the ones in the archive file.

You can find all versions of the library here: https://github.com/geopaparazzi/libjsqlite-spatialite-android/tree/master/archive:



来源:https://stackoverflow.com/questions/36274100/java-lang-unsatisfiedlinkerror-in-jsqlite-database-internal-init-in-android-spat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!