C# 缺少Xamarin SQlitePlatformAndroid()

C# 缺少Xamarin SQlitePlatformAndroid(),c#,xamarin,C#,Xamarin,İ我试图使用SQLite,但找不到SQLitePlatformAndroid 您需要在Android项目中添加SQLite NuGet包,并将名称空间添加到文件中 SQLite.Net.Platform.XamarinAndroid 在所有项目中添加SQLite.Net-PCL public SQLiteConnection GetConnection() { var sqliteFilename = "Test.db3"; string docum

İ我试图使用SQLite,但找不到SQLitePlatformAndroid


您需要在Android项目中添加SQLite NuGet包,并将名称空间添加到文件中

SQLite.Net.Platform.XamarinAndroid
在所有项目中添加SQLite.Net-PCL

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