title: Android - The type initializer for 'SQLite.SQLiteConnection' threw an exception. ---> System.DllNotFoundException: e_sqlite3
body: <p>On our Xamarin Android project we are trying to switch from sqlite-net to official sqlite-net-pcl package.</p>
  
  <p><a href="https://i.stack.imgur.com/mG9V4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mG9V4.png" alt="enter image description here"></a></p>
  
  <p>However after this switch when creating a new SQLiteConnection I am getting following exception:</p>
  
  <blockquote>
    <p>The type initializer for 'SQLite.SQLiteConnection' threw an exception.
    ---> System.DllNotFoundException: e_sqlite3</p>
  </blockquote>
  
  <p>Full exception:</p>
  
  <blockquote>
    <p>Xamarin caused by: android.runtime.JavaProxyThrowable:
    System.TypeInitializationException: The type initializer for
    'SQLite.SQLiteConnection' threw an exception. --->
    System.DllNotFoundException: e_sqlite3   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) [0x00000]
    in &lt;4472a4c16754425197d915f39ebd937e>:0    at
    SQLitePCL.Batteries_V2.Init () [0x0000d] in
    &lt;1125db7e18f0475797b2764ec6653cf1>:0    at
    SQLite.SQLiteConnection..cctor () [0x00000] in
    /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:171     --- End
    of inner exception stack trace ---    at
    mono.android.view.View_OnClickListenerImplementor.n_onClick(Native
    Method)   at
    mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:30)
      at android.view.View.performClick(View.java:4780)   at
    android.view.View$PerformClick.run(View.java:19866)   at
    android.os.Handler.handleCallback(Handler.java:739)   at
    android.os.Handler.dispatchMessage(Handler.java:95)   at
    android.os.Looper.loop(Looper.java:135)   at
    android.app.ActivityThread.main(ActivityThread.java:5254)     at
    java.lang.reflect.Method.invoke(Native Method)    at
    java.lang.reflect.Method.invoke(Method.java:372)  at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)</p>
  </blockquote>
  
  <p>In the log I can see following info:</p>
  
  <blockquote>
    <p>12-01 10:43:05.356 D/Mono    (11194): DllImport attempting to load:
    'e_sqlite3'. 12-01 10:43:05.358 D/Mono    (11194): DllImport error
    loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3"
    not found'. 12-01 10:43:05.360 D/Mono    (11194): DllImport error
    loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so"
    not found'. 12-01 10:43:05.360 D/Mono    (11194): DllImport error
    loading library '/system/lib/libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3" not
    found'. 12-01 10:43:05.360 D/Mono    (11194): DllImport error loading
    library '/system/lib/libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"
    not found'. 12-01 10:43:05.360 D/Mono    (11194): DllImport error
    loading library 'libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.361 D/Mono    (11194): DllImport error loading library
    'libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so" not found'.
    12-01 10:43:05.361 D/Mono    (11194): DllImport error loading library
    'e_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/e_sqlite3" not found'. 12-01
    10:43:05.362 D/Mono    (11194): DllImport error loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3"
    not found'. 12-01 10:43:05.364 D/Mono    (11194): DllImport error
    loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so"
    not found'. 12-01 10:43:05.364 D/Mono    (11194): DllImport error
    loading library '/system/lib/libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3" not
    found'. 12-01 10:43:05.364 D/Mono    (11194): DllImport error loading
    library '/system/lib/libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"
    not found'. 12-01 10:43:05.364 D/Mono    (11194): DllImport error
    loading library 'libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.364 D/Mono    (11194): DllImport error loading library
    'libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so" not found'.
    12-01 10:43:05.365 D/Mono    (11194): DllImport error loading library
    'libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.365 W/Mono    (11194): DllImport unable to load library
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.365 D/Mono    (11194): DllImport attempting to load:
    'e_sqlite3'. 12-01 10:43:05.366 D/Mono    (11194): DllImport error
    loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3"
    not found'. 12-01 10:43:05.368 D/Mono    (11194): DllImport error
    loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so"
    not found'. 12-01 10:43:05.368 D/Mono    (11194): DllImport error
    loading library '/system/lib/libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3" not
    found'. 12-01 10:43:05.368 D/Mono    (11194): DllImport error loading
    library '/system/lib/libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"
    not found'. 12-01 10:43:05.368 D/Mono    (11194): DllImport error
    loading library 'libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.368 D/Mono    (11194): DllImport error loading library
    'libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so" not found'.
    12-01 10:43:05.369 D/Mono    (11194): DllImport error loading library
    'e_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/e_sqlite3" not found'. 12-01
    10:43:05.370 D/Mono    (11194): DllImport error loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3"
    not found'. 12-01 10:43:05.371 D/Mono    (11194): DllImport error
    loading library
    '/storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so':
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.<strong>override</strong>/libe_sqlite3.so"
    not found'. 12-01 10:43:05.372 D/Mono    (11194): DllImport error
    loading library '/system/lib/libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3" not
    found'. 12-01 10:43:05.372 D/Mono    (11194): DllImport error loading
    library '/system/lib/libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"
    not found'. 12-01 10:43:05.372 D/Mono    (11194): DllImport error
    loading library 'libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.372 D/Mono    (11194): DllImport error loading library
    'libe_sqlite3.so': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so" not found'.
    12-01 10:43:05.373 D/Mono    (11194): DllImport error loading library
    'libe_sqlite3': 'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.
    12-01 10:43:05.373 W/Mono    (11194): DllImport unable to load library
    'dlopen failed: library
    "/data/app/com.psonar.android-1/lib/x86/libe_sqlite3" not found'.</p>
  </blockquote>
  
  <p>It's obvious what's wrong: <strong>System.DllNotFoundException: e_sqlite3</strong> however I can't find any relevant info that would lead to solving this problem. </p>
  
  <p>I checked my nuget packages and they all seem to be correctly installed.</p>
  
  <p><a href="https://i.stack.imgur.com/TeR0i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TeR0i.png" alt="enter image description here"></a></p>
  
  <p>I checked the package location and it is all correct. Very unsure where the cause might be.</p>
  
  <p><strong>EDIT:</strong>
  Reported to the author of the package in here:
  <a href="https://github.com/praeclarum/sqlite-net/issues/478" rel="nofollow noreferrer">https://github.com/praeclarum/sqlite-net/issues/478</a></p>