1

I seem to be hitting all sorts of problems today. I simply cannot get Sqlite-net-pcl to behave correctly when signing an APK. Debug and release work fine but everytime I create a signed version of the APK the app crashes with this issue:-

SQLite.SQLiteException: Cannot add a PRIMARY KEY column

Here is an example of my model:-

using SQLite.Net.Attributes;
using System;

namespace App.BusinessLayer.LocalObjects
{
[Preserve(AllMembers = true)]
public class LocalTip
{

public int ID { get; set; }

[PrimaryKey, Column("tipObjectId")]
public string objectId { get; set; }
public DateTime createdAt { get; set; }
public DateTime updatedAt { get; set; }
public string Title { get; set; }
public string Bet { get; set; }
public string Description { get; set; }
public string Rating { get; set; }
public string Time { get; set; }
public string Bookies { get; set; }
public string Url { get; set; }
public int Status { get; set; }
public Double Odds { get; set; }
public int Outcome { get; set; }

public LocalTip()
{
    this.objectId = " ";
    this.Title = " ";
    this.Bet = " ";
    this.Description = " ";
    this.Rating = " ";
    this.Time = " ";
    this.Bookies = " ";
    this.Url = " ";
}
}
}

Has anyone seen this before?

Phill Wiggins
  • 2,577
  • 4
  • 28
  • 33
  • 1
    Strange thing is the app crashes when it loads with the above issue. If you go to Applications and Clear Data for this app, it works perfect then? – Phill Wiggins Jan 21 '17 at 13:45
  • You can't add a Primary Key column to an already existing table – redent84 Jan 21 '17 at 15:43
  • When you delete the application, the database is deleted and the table is created from scratch with the correct primary key column – redent84 Jan 21 '17 at 15:44
  • @redent84 Okay so situation... I clear the data from my app, uninstall the app from my device. I then install the APK again, loads the app, it crashes. I then go to application settings and delete storage of the app and it works. Hence why I'm so confused on this one. – Phill Wiggins Jan 21 '17 at 18:36
  • Check it out, it seems to be Android v7 that it's crashing with maybe. I accidentally uploaded it to the Play Store as it wasn't doing the same on a V6. The apps called FiveStarTips. I really don't get how this is happening. @redent84 – Phill Wiggins Jan 21 '17 at 18:42

0 Answers0