3
votes

I receive an SQLite exception when creating a connection.

This worked before I installed VS2015 RTM.

Client (PCL):

 _databaseConnection = DependencyService.Get<IDatabase>().Connect();

Android project:

 public SQLiteConnection Connect()
 {
    var fileName = "my_file.db3";
    var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
    var path = Path.Combine(documentsPath, fileName);
    var connection = new SQLiteConnection(path);

    return connection;
 }

I receive an exception when executing:

 var connection = new SQLiteConnection(path);

Something went wrong in the build configuration. This is the bait assembly, which is for referencing by portable libraries, and should never end up part of the app.

NOTE:

SQLitePCL.raw_basic is on 0.7.1 I get errors whenever I attempt to upgrade the version to 0.8.1

Again, this all worked before I installed VS2015 RTM Any suggestions?

1
Which SQLite-NET nuget are you using? There are a few similarly named packages, so it's good to know. I recommend this one: nuget.org/packages/sqlite-net-pcl Did you update anything else when you upgraded to VS2015, or change the PCL profile being used... it kinda sounds like the project type is no longer one supported by the nuget. - Conceptdev

1 Answers

2
votes

You need to initialize a new connection and you will need an ISQLitePlatform implementation.

var platform = new SQLitePlatformAndroid();
var connection = new SQLiteConnection(platform, path);