【发布时间】:2019-07-30 10:36:21
【问题描述】:
我正在使用 VS 2017 和 XAMARIN/Android 和 SQLite。在“调试”模式下没有问题。当我尝试在智能手机上运行 android“发布”模式时,出现以下错误:
未处理的异常: System.Exception:无法创建没有列的表('SolarmonAndroidApp.Models.TicketPageModels.TicketType' 有公共属性吗?)
如何正确配置应用程序以在 Android 手机上安装SQLite_DB。
型号:
using SQLite;
using System;
using System.Collections.Generic;
using System.Text;
namespace SolarmonAndroidApp.Models.TicketPageModels
{
public class TicketType
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public int _Id { get; set; }
public string Name { get; set; }
public bool IsActive { get; set; }
public bool IsFixed { get; set; }
}
}
来电:
_sql.CreateTable<TicketAction>();
_sql.CreateTable<TicketType>();
_sql.CreateTables<Park, Section, Ticket, User>();
_sql.CreateTables<Row, Inverter, Number, Pool, Attachment>();
_sql.CreateTable<CatchLog>();
_sql.CreateTable<AppSettings>();
_sql.CreateTables<TicketChecklist, TicketCheckpoint, SubTicket>();
【问题讨论】:
-
我认为这个异常是不言自明的,你的模型中的 TicketType 类 > TicketPageModelsm 有公共属性吗?在此处发布您的课程,以便我们提供帮助
-
您需要发布导致错误的代码。否则我们无法为您提供帮助。也许从 1. 您如何尝试创建表开始?,2. 您如何定义要为其创建表的类?
-
它不仅在发布模式下工作吗?即它是否在调试模式下工作?
-
@bwt yes 在调试模式下没问题
-
什么是链接模式(项目的属性/Android选项/链接)?是 Sdk 和用户程序集 吗?
标签: android sqlite xamarin android-sqlite