Android - 'SQLite.SQLiteConnection' 的类型初始值设定项引发异常.--->System.DllNotFoundException: e_sqlite3 [英] Android - The type initializer for 'SQLite.SQLiteConnection' threw an exception. ---> System.DllNotFoundException: e_sqlite3

查看:23
本文介绍了Android - 'SQLite.SQLiteConnection' 的类型初始值设定项引发异常.--->System.DllNotFoundException: e_sqlite3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的 Xamarin Android 项目中,我们正尝试从 sqlite-net 切换到官方 sqlite-net-pcl 包.

On our Xamarin Android project we are trying to switch from sqlite-net to official sqlite-net-pcl package.

但是,在创建新的 SQLiteConnection 之后,我收到以下异常:

However after this switch when creating a new SQLiteConnection I am getting following exception:

'SQLite.SQLiteConnection' 的类型初始值设定项抛出异常.---> System.DllNotFoundException: e_sqlite3

The type initializer for 'SQLite.SQLiteConnection' threw an exception. ---> System.DllNotFoundException: e_sqlite3

完全例外:

Xamarin 引起的:android.runtime.JavaProxyThrowable:System.TypeInitializationException:类型初始值设定项'SQLite.SQLiteConnection' 抛出异常.--->System.DllNotFoundException: e_sqlite3 at (wrapper管理到本地)SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods:sqlite3_libversion_number() 在SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number() [0x00000] in :0 atSQLitePCL.raw.SetProvider (SQLitePCL.ISQLite3Provider imp) [0x00000]在 <4472a4c16754425197d915f39ebd937e>:0 处SQLitePCL.Batteries_V2.Init()[0x0000d]中<1125db7e18f0475797b2764ec6653cf1>:0 在SQLite.SQLiteConnection..cctor() [0x00000] 中/Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:171 --- 结束内部异常堆栈跟踪 --- 在mono.android.view.View_OnClickListenerImplementor.n_onClick(原生方法)在mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:30)在 android.view.View.performClick(View.java:4780) 在android.view.View$PerformClick.run(View.java:19866) 在android.os.Handler.handleCallback(Handler.java:739) 在android.os.Handler.dispatchMessage(Handler.java:95) 在android.os.Looper.loop(Looper.java:135) 在android.app.ActivityThread.main(ActivityThread.java:5254) 在java.lang.reflect.Method.invoke(Native Method) 在java.lang.reflect.Method.invoke(Method.java:372) 在com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

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 <4472a4c16754425197d915f39ebd937e>:0 at SQLitePCL.Batteries_V2.Init () [0x0000d] in <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)

在日志中我可以看到以下信息:

In the log I can see following info:

12-01 10:43:05.356 D/Mono (11194):DllImport 尝试加载:'e_sqlite3'.12-01 10:43:05.358 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3"未找到'.12-01 10:43:05.360 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so':'dlopen 失败:库"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so"未找到'.12-01 10:43:05.360 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3"不是成立'.12-01 10:43:05.360 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3.so':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"未找到'.12-01 10:43:05.360 D/Mono (11194): DllImport 错误加载库libe_sqlite3":dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.361 D/Mono (11194): DllImport 错误加载库'libe_sqlite3.so': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so"未找到'.12-01 10:43:05.361 D/Mono (11194): DllImport 错误加载库'e_sqlite3': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/e_sqlite3"未找到'.12-0110:43:05.362 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3"未找到'.12-01 10:43:05.364 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so':'dlopen 失败:库"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so"未找到'.12-01 10:43:05.364 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3"不是成立'.12-01 10:43:05.364 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3.so':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"未找到'.12-01 10:43:05.364 D/Mono (11194): DllImport 错误加载库libe_sqlite3":dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.364 D/Mono (11194): DllImport 错误加载库'libe_sqlite3.so': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so"未找到'.12-01 10:43:05.365 D/Mono (11194): DllImport 错误加载库'libe_sqlite3': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.365 W/Mono (11194): DllImport 无法加载库'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.365 D/Mono (11194):DllImport 尝试加载:'e_sqlite3'.12-01 10:43:05.366 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3"未找到'.12-01 10:43:05.368 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so':'dlopen 失败:库"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so"未找到'.12-01 10:43:05.368 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3"不是成立'.12-01 10:43:05.368 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3.so':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"未找到'.12-01 10:43:05.368 D/Mono (11194): DllImport 错误加载库libe_sqlite3":dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.368 D/Mono (11194): DllImport 错误加载库'libe_sqlite3.so': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so"未找到'.12-01 10:43:05.369 D/Mono (11194): DllImport 错误加载库'e_sqlite3': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/e_sqlite3"未找到'.12-0110:43:05.370 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3"未找到'.12-01 10:43:05.371 D/Mono (11194): DllImport 错误加载库'/storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so':'dlopen 失败:库"/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.覆盖/libe_sqlite3.so"未找到'.12-01 10:43:05.372 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3"不是成立'.12-01 10:43:05.372 D/Mono (11194): DllImport 错误加载库'/system/lib/libe_sqlite3.so':'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86//system/lib/libe_sqlite3.so"未找到'.12-01 10:43:05.372 D/Mono (11194): DllImport 错误加载库libe_sqlite3":dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.372 D/Mono (11194): DllImport 错误加载库'libe_sqlite3.so': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3.so"未找到'.12-01 10:43:05.373 D/Mono (11194): DllImport 错误加载库'libe_sqlite3': 'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.12-01 10:43:05.373 W/Mono (11194): DllImport 无法加载库'dlopen 失败:库/data/app/com.psonar.android-1/lib/x86/libe_sqlite3"未找到'.

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/.override/libe_sqlite3': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3.so': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3.so': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3.so': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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/.override/libe_sqlite3.so': 'dlopen failed: library "/data/app/com.psonar.android-1/lib/x86//storage/emulated/0/Android/data/com.psonar.android/files/.override/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'.

很明显出了什么问题:System.DllNotFoundException: e_sqlite3 但是我找不到任何可以解决此问题的相关信息.

It's obvious what's wrong: System.DllNotFoundException: e_sqlite3 however I can't find any relevant info that would lead to solving this problem.

我检查了我的 nuget 软件包,它们似乎都已正确安装.

I checked my nuget packages and they all seem to be correctly installed.

我检查了包裹位置,一切都正确.非常不确定原因可能在哪里.

I checked the package location and it is all correct. Very unsure where the cause might be.

在这里向包的作者报告:https://github.com/praeclarum/sqlite-net/issues/478

Reported to the author of the package in here: https://github.com/praeclarum/sqlite-net/issues/478

推荐答案

nuget 包也必须安装在我们的主 droid 应用项目中.如果它安装在不是应用启动项目的解决方案项目中,则会产生这些问题.

The nuget package had to be installed in our main droid app project as well. If it is installed in a solution project which is not the app start project then it creates these problems.

这篇关于Android - 'SQLite.SQLiteConnection' 的类型初始值设定项引发异常.--->System.DllNotFoundException: e_sqlite3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆