[英]Xamarin Override RemoteControlReceived in Dependency Injection
[英]Error with Dependency Injection [Xamarin]
我正在我的应用程序上实现一个 SQLite 数据库。
我有一个处理数据库连接的 SQLite_Android 类。 当我插入依赖项( [assembly: Dependency(typeof(SQLite_Android))] )时,我收到了很多错误,例如:
检索项目的父项时出错:找不到与给定名称“Animation.AppCompat.Dialog”匹配的资源
检索项目的父项时出错:找不到与给定名称“TextAppearence.AppCompat.Button”匹配的资源
找不到与给定名称匹配的资源:attr 'backgroundTint'。
找不到与给定名称匹配的资源:attr 'elevation'。
最后:
意外错误 - 请在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();
}
}
您应该指定类的完整路径 [assembly: Dependency(typeof(AppName.Path.SQLite_Android))]
例如:[程序集:依赖(typeof(AppName.Droid.DataBaseHelper.SQLite_Android))]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.