Sqlite-net: System.DllNotFoundException: /system/lib/libsqlite.so exception on Android 7

Created on 26 Aug 2018  路  9Comments  路  Source: praeclarum/sqlite-net

Hi,

I copied SQLite.cs and SQLiteAsync.cs in order to use Sqlite-net in my Xamarin.Android project, my app works on all Android versions but v7.0 (I didn't test on v+7.0).

I got following exception:

System.DllNotFoundException: /system/lib/libsqlite.so exception on Android 7

Error happens here: LibVersionNumber = SQLite3.LibVersionNumber ();,

Is this a bug, or I miss something?

Most helpful comment

@Weldryn I think you need to read the Readme again, specially following section:

source-installation

There is no warning, use with caution or something like that.

I read mentioned article and some other articles, and I know how to solve this problem (actually I already did), I reported this issue, just to help and contribute.

BTW, there is no reason to understand everything in order to use source code of some library. using source code (specially when the developer mentioned in Readme section, like this project) is good idea, even if you don't know and understand all of its codes.

All 9 comments

You are missing how to use a package.
I recommend you always have a deep read of the Readme of a repository before doing anything. Also, reading the online tutorials definitely help, they are meant for that.
Don't just copy/paste source files unless you know what you are doing.

Hope this helps!

Don't forget to close the issue when done with it please.

@Weldryn I think you need to read the Readme again, specially following section:

source-installation

There is no warning, use with caution or something like that.

I read mentioned article and some other articles, and I know how to solve this problem (actually I already did), I reported this issue, just to help and contribute.

BTW, there is no reason to understand everything in order to use source code of some library. using source code (specially when the developer mentioned in Readme section, like this project) is good idea, even if you don't know and understand all of its codes.

Hi, Please use the sqlite-net-pcl nuget package. Using from source requires that you provide your own binary for sqlite.

@praeclarum Okay, can you add this note to README? I think it helps.

@dehghani-mehdi how to solve this problem?

@nnnhi I removed SQLite.cs and SQLiteAsync.cs and then installed sqlite-net-pcl

Hi, Please use the sqlite-net-pcl nuget package. Using from source requires that you provide your own binary for sqlite.

Good day @praeclarum
I am using the sqlite-net-pcl 1.1.1 and SQLitePCL.raw 0.8.6 nugets since a long time in the same app. Everything was working fine, until recently compiled against Android 7 and tested on an Android device with 7, and facing the issue, System.DllNotFoundException: /system/lib64/libsqlite.so. App crashes. Do I need to update the nugets? Please advise.

I've updated my SQLite class with this property:

[DllImport("sqlite3", EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
internal static extern Result Config(ConfigOption option);

In the constructor of my SQLite class I called

Config(ConfigOption.Serialized);

It works now.

{System.TypeInitializationException: The type initializer for 'SQLite.SQLiteConnection' threw an exception. ---> System.DllNotFoundException: e_sqlite3 assembly: type: member:(null)
at (wrapper managed-to-native) SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number () [0x00000] in :0
at SQLitePCL.raw.SetProvider (SQLitePCL.ISQLite3Provider imp) [0x00008] in <61f7edf725d84e86bad37534de465b1f>:0
at SQLitePCL.Batteries_V2.Init () [0x00005] in <1e145190beee47768df5e21ac9abfe79>:0
at SQLite.SQLiteConnection..cctor () [0x00016] in :0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at PhxGaugingAndroid.Fragments.WorkOrderFragment.GetWorkOrderList () [0x00087] in E:LdarVOCsToolPhxGaugingV6PhxGaugingAndroidFragmentsWorkOrderFragment.cs:1966

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shaman4k picture shaman4k  路  5Comments

Freddixx picture Freddixx  路  4Comments

ToddThomson picture ToddThomson  路  3Comments

rynjas picture rynjas  路  3Comments

pha3z picture pha3z  路  4Comments