Forum Xamarin Xamarin.Android

dll issue with sqlite with nougat version 7.0

Hi @BrendanZagaeski

We are facing the issue with sqlite in nougat version 7.0 below is the description containing exception details.

{System.DllNotFoundException: /system/lib64/
at (wrapper managed-to-native) SQLite.SQLite3:Open (byte[],intptr&,int,intptr)
at SQLite.SQLiteConnection..ctor (System.String databasePath, SQLite.SQLiteOpenFlags openFlags, System.Boolean storeDateTimeAsTicks) [0x0005e] in C:\Users\davenders\Desktop\eventp\EventPower_EV\EventPower-EV\EventPower_EV.Droid\ORM\SQLite.cs:198
at SQLite.SQLiteConnection..ctor (System.String databasePath, System.Boolean storeDateTimeAsTicks) [0x00000] in C:\Users\davenders\Desktop\eventp\EventPower_EV\EventPower-EV\EventPower_EV.Droid\ORM\SQLite.cs:162
at EventPower_EV.Droid.Activities.ActivationActivity.CheckAndCreateDatabase (System.String dbName) [0x00002] in C:\Users\davenders\Desktop\eventp\EventPower_EV\EventPower-EV\EventPower_EV.Droid\Activities\ActivationActivity.cs:385 }


  • DavenderSinghDavenderSingh USMember ✭✭

    any suggestion from anyone would be appreciated ..


  • StefaanAvonds.3725StefaanAvonds.3725 USMember ✭✭✭

    When exactly are you getting this error?

    If it is of any help, I developed an Install-and-Go package for SQLite (both for Android and iOS), maybe this can help you get rid of the errors: SQLiteDatabase.

  • DavenderSinghDavenderSingh USMember ✭✭

    dlls are working fine with Marshmallow and lollipop androids but creating issue while running on nougat device . basically it is throwing exception while calling

    public SQLiteConnection (string databasePath, bool storeDateTimeAsTicks = false)
    : this (databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, storeDateTimeAsTicks)
    in Sqlite.cs file.

  • StefaanAvonds.3725StefaanAvonds.3725 USMember ✭✭✭

    It seems to be a known "issue" for Android Nougat done on purpose: Xamarin release notes.

    In previous releases, Mono.Data.Sqlite.dll would P/Invoke into the OS-provided /system/lib/ native library. Starting with Android N, Android will no longer permit this behavior, so previous versions of Mono.Data.Sqlite.dll will throw a DllNotFoundException when attempting to use SQLite functionality when executing on Android N.

    To solve this, you can use the Nuget-package "sqlite-net-pcl" from Frank A. Krueger. You could also use the Nuget-package from above since this one uses the package from Frank A Kreuger.

  • DavenderSinghDavenderSingh USMember ✭✭

    I added new references of "sqlite-net-pcl" and other dependent references from nuget manager . the Image containing the screenshots of the references added but it still throwing the same exception

  • StefaanAvonds.3725StefaanAvonds.3725 USMember ✭✭✭

    Did you install it on both Android and PCL?

    You could try to uninstall everything from SQLite that you have in your entire solution and install the sqlite-net-pcl package again?

  • DavenderSinghDavenderSingh USMember ✭✭

    its solved now ... Thanks for your help :)

  • StefaanAvonds.3725StefaanAvonds.3725 USMember ✭✭✭

    What was the solution? Uninstall and reinstall?

  • beer73beer73 ESMember

    @DavenderSingh said:
    its solved now ... Thanks for your help :)

    What was the solution? Uninstall and reinstall?
    What was the solution? Uninstall and reinstall?
    What was the solution? Uninstall and reinstall?

    @DavenderSingh It would be nice if you share the solution with the rest of the people who are stuck in that issue (as me).

  • DavenderSinghDavenderSingh USMember ✭✭

    I uninstalled all the old library references from the solution and then installed "sqlite-net-pcl" from Frank A. Krueger . which doesn't actually provide you the couple of cs files but it adds few .dlls for your solution. so you have to update your code if you haves already played with those old class SQLlite files.

  • beer73beer73 ESMember

    Ok, thanks for your response.

    But in my case the thing was a little different (I will explain for help others):

    First installed last sqlite-net-pcl 1.3.1 (FIRST ERROR) and a bunch of 40 referenced packages (1.3.1 is for .NetStandard).
    As always Nougat crashed without locating sqlite dll's (type initializer exception).
    I uninstall all installed packages, and now I installed sqlite-net-pcl 1.2.1.
    But again Nougat crashed without locating (the f....) sqlite dll's
    Then I found the solution here
    My app have separated projects, one BL library, and my Android main project that consume the BL lib.
    The solution is that you must install the sqlite-net-pcl package (and its references) in the library --AND-- in the main project.

    Now Nougat works fine with my database.

    (Very frustrating, almost two days with this)

  • NinineaNininea USUniversity ✭✭✭

    I have installed sqlite-net-pcl 1.2.1 in both projects, android and pcl, but still get the same problem :(

  • munenemunene KEMember

    My solution was to update sql-net-pcl by Frank A. Krueger to version 1.4.118 on all projects within my solution

Sign In or Register to comment.