在我的数据库中:
databasePath = GetPath(docsFolder);
connection = new SQLiteAsyncConnection(databasePath);
connection.CreateTableAsync<BO>().Wait();
数据库路径为/data/user/0/com.companyname.AppName/files/fn.db3 (仅在此处筛选包名)
但是当创建一个表:未处理异常: System.AggregateException:发生一个或多个错误时,就会发生这种情况。
在BO中,我已经删除了DateTime:当前只有字符串和int是应用的类型。
public class BO
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public string From { get; set; }
public string To { get; set; }
public string Note { get; set; }
}
NuGet:
<package id="sqlite-net-pcl" version="1.4.118" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.5" targetFramework="portable45-net45+win8+wpa81" />
<package id="SQLitePCLRaw.core" version="1.1.5" targetFramework="portable45-net45+win8+wpa81" />
编辑:在AggregateException
中有一个TypeInitializationException
,它在创建表时发生。但是,在调试时,SQLite.SQLiteConnection
被声明为关于TypeInitializationException
的TypeName。SQLiteAsyncConnection connection
在代码中有明确的定义。是否缺少创建db文件的特权?
发布于 2018-02-08 16:34:31
Android项目中缺少了两个软件包。
SQLitePCLRaw.lib.e_sqlite3.android
SQLitePCLRaw.provider.e_sqlite3.android
https://stackoverflow.com/questions/48597444
复制