我正在我的应用上实现一个SQLite数据库。
我有一个处理数据库连接的SQLite_Android类。当我插入依赖项( [assembly:Dependency(typeof(SQLite_Android))] 时,我会遇到很多错误:
检索项目的父项时出错:找不到与给定名称“Animation.AppCompat.Dialog”匹配的资源
检索项目的父项时出错:找不到与给定名称匹配的资源'TextAppearence.AppCompat.Button'
找不到与给定名称匹配的资源:attr'backgroundTint'。
找不到与给定名称匹配的资源:attr'halev'。
最后:
意外错误 - 请在http://bugzilla.xamarin.com提交错误报告。原因:System.IO.FileNotFoundException:无法加载程序集“MyProject.App.Engine.Droid,Version =,Culture = neutral,PublicKeyToken ='。也许它在Mono for Android配置文件中不存在?
当我从该类中取出该依赖项时,该应用程序已成功构建。
我已经尝试过的事情:
所以,有人请告诉我如何解决这个问题
OBS,这是我的界面和我的DBhelper:
[assembly: Dependency(typeof(SQLite_Android))]
namespace MyProject.Device.Engine.Droid.DB
{
public class SQLite_Android : ISQLConfig
{
public SQLite_Android(){}
public SQLite.Net.SQLiteConnection GetConnection()
{
var fileName = "DbFile.db3";
var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var path = Path.Combine(documentsPath, fileName);
var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid();
var connection = new SQLite.Net.SQLiteConnection(platform, path);
return connection;
}
}
namespace MyProject.Device.Engine.Shared.Portable.DB
{
public interface ISQLConfig
{
SQLiteConnection GetConnection();
}
}
答案 0 :(得分:0)
您必须指定类的完整路径[assembly:Dependency(typeof(AppName.Path.SQLite_Android))]
例如: [assembly:Dependency(typeof(AppName.Droid.DataBaseHelper.SQLite_Android))]