【问题标题】:Xamarin Sqlite-pcl library problemsXamarin Sqlite-pcl 库问题
【发布时间】:2017-02-15 08:53:11
【问题描述】:

我尝试制作一个应用程序并使用sqlite-pcl 并在我的应用程序启动时收到以下错误;

DllImport attempting to load: 'e_sqlite3'.
DllImport error loading library '/storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3" not found'.
DllImport error loading library '/storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3.so': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3.so" not found'.
DllImport error loading library '/system/lib/libe_sqlite3': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//system/lib/libe_sqlite3" not found'.
DllImport error loading library '/system/lib/libe_sqlite3.so': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//system/lib/libe_sqlite3.so" not found'.
DllImport error loading library 'libe_sqlite3': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86/libe_sqlite3" not found'.
DllImport loaded library 'libe_sqlite3.so'.
DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
Searching for 'sqlite3_libversion_number'.
An unhandled exception occured.

我在便携式和机器人两种解决方案中都安装了 nuget 包。我在 droid 项目中安装了Sqlite 组件。

我清理了构建并重新编译,但它返回了相同的错误。

编辑:

我在编译器调试中发现了这个;

Loaded assembly: /storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/SQLitePCLRaw.lib.e_sqlite3.dll

似乎 e_sqlite3.dll 已经在项目中了。

提前致谢

【问题讨论】:

  • 你能添加一个链接到你下载的具体包吗?

标签: sqlite xamarin


【解决方案1】:

“DllImport error loading library '.../.override/libe_sqlite3'”消息也误导了我。调试输出正好与冻结我的应用的实际异常一致。

对我来说,它在 new SQLiteConnection() 中使用了相对路径——在使用 UWP 版本之前它工作得非常好。在我将其更改为使用绝对路径后,它也可以在 Android 上运行:

var dbpath = Path.Combine(System.Environment.GetFolderPath(
    System.Environment.SpecialFolder.LocalApplicationData), "myData.sqlite");
db = new SQLiteConnection(dbpath, false);

【讨论】:

    【解决方案2】:

    我认为该软件包尚未正确安装在您的启动应用上。删除sqlite-pcl,清理、重建并将其安装到您的启动应用程序和机器人项目中。还要检查您的参考资料,看看它是否真的存在。

    【讨论】:

      【解决方案3】:

      我发现了我的错误。我有一个像这样的课程;

      public class StaticsValues
      {
          [...]
          public static string FOLDERPATH;
          public static string DBPATH;
          public static BD.BDManager BDMANAGER = new BD.BDManager;
      }
      

      在我的 DROID 项目编译之前,对象 BDManager 在解决方案中开始。我改为:

      public class StaticsValues
      {
          [...]
          public static string FOLDERPATH;
          public static string DBPATH;
          public static BD.BDManager BDMANAGER ;
      }
      

      然后在App.cs 中启动BD.Manager,现在可以工作了。

      【讨论】:

        猜你喜欢
        • 2021-08-13
        • 2017-05-17
        • 1970-01-01
        • 2018-07-06
        • 2023-03-19
        • 2017-06-24
        • 2017-11-05
        • 1970-01-01
        • 2014-08-18
        相关资源
        最近更新 更多