Xamarin Android中连接字符串上的System.DllNotFoundException

时间:2019-03-15 11:34:07

标签: c# xamarin xamarin.forms xamarin.android xamarin.ios

试图在我的新应用程序中使用use SQLite数据库,我看到的是这个奇怪的异常DLLNotFoundException,但我已经添加了我希望的一切。

我正在使用SQLite.Net-PCL 3.1.1

SQLite连接代码:

 public SQLite.Net.SQLiteConnection GetConnection()
    {
        var sqliteFilename = "xamdblocal.db3";
        string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder
        var path = Path.Combine(documentsPath, sqliteFilename);
        Console.WriteLine(path);
        if (!File.Exists(path)) File.Create(path);
        var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid();
        var conn = new SQLite.Net.SQLiteConnection(plat, path);
        // Return the database connection 
        return conn;
    }

它进入catch块,在这里我在conn上初始化连接。

我在这里错过了什么吗?我很困惑,我的意思是我一直都这样做,而且一直有效。

StackTrace:

  

at(包装器托管到本地)SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroidInternal.sqlite3_open_v2(byte [],intptr&,int,intptr)     在SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroid.Open(System.Byte []文件名,SQLite.Net.Interop.IDbHandle&db,System.Int32标志,System.IntPtr zvfs)[0x00000]在<8dbf6ff85082469fb9d4dfaa9eae6b69>:0中     在SQLite.Net.SQLiteConnection..ctor(SQLite.Net.Interop.ISQLitePlatform sqlitePlatform,System.String databasePath,SQLite.Net.Interop.SQLiteOpenFlags openFlags,System.Boolean storeDateTimeAsTicks,SQLite.Net.IBlobSerializer序列化程序,System.Collections.Generic .IDictionary 2[TKey,TValue] tableMappings, System.Collections.Generic.IDictionary 2 [TKey,TValue] extraTypeMappings,SQLite.Net.IContractResolver解析器)[0x000a2]在<8f2bb39aeff94a30a8628064be9c7efe>:0中     在SQLite.Net.SQLiteConnection..ctor(SQLite.Net.Interop.ISQLitePlatform sqlitePlatform,System.String databasePath,System.Boolean storeDateTimeAsTicks,SQLite.Net.IBlobSerializer序列化程序,System.Collections.Generic.IDictionary 2[TKey,TValue] tableMappings, System.Collections.Generic.IDictionary 2 [ [TKey,TValue] extraTypeMappings,SQLite.Net.IContractResolver解析器)[0x00000]在<8f2bb39aeff94a30a8628064be9c7efe>:0中     在D:\ AndroidXam \ XamAndroid \ XamAndroid \ SQLiteDB \ XamDb.cs:83中的XamAndroid.SQLiteDB.XamDb.GetConnection()[0x00039]     在D:\ AndroidXam \ XamAndroid \ XamAndroid \ SQLiteDB \ XamDb.cs:97中的XamAndroid.SQLiteDB.XamDb.CreateDatabase()[0x00001]     在D:\ AndroidXam \ XamAndroid \ XamAndroid \ SQLiteDB \ XamDb.cs:50的XamAndroid.SQLiteDB.XamDb.InitDatabase()[0x00004]

异常消息: /system/lib64/libsqlite.so(如果有人需要)。

0 个答案:

没有答案