SQLite.Net-PCL icon indicating copy to clipboard operation
SQLite.Net-PCL copied to clipboard

SQLitePlatformAndroid and SQLitePlatformIOS instantiation fails

Open blmiles opened this issue 8 years ago • 6 comments

Hello,

var sqlitePlatform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(); OR var sqlitePlatform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformIOS();

both cause this error: "VTable setup of type SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroid failed" OR "VTable setup of type SQLite.Net.Platform.XamarinIOS.SQLiteApiIOS failed"

All refs and using statements correct. I can instantiate a SQLiteConnnection if I put this directly into the args: new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid() but not by creating a sqlitePlatform first to add as an arg for the SQLiteConnection(platform, path)

This is in a Xamarin Forms shared project.

Another explanation is here: https://forums.xamarin.com/discussion/95904/sqlite-net-connections-and-xamarin-forms#latest

Please advise if at all possible.

Thanks

blmiles avatar May 19 '17 20:05 blmiles

Kudos to the guys fixing/maintaining SQLite.Net PCL and Extensions. Whoever patched those, you've solved this particular issue!

Thank you!

blmiles avatar May 20 '17 13:05 blmiles

Hi, @blmiles I still have this same issue, how do I fix it. This is in a Xamarin.iOS project

ikiugu avatar May 29 '17 10:05 ikiugu

Actually, I didn't do anything. I noticed the day after seeing this issue, package updates was showing an update for SQLite.Net and Extensions. Updated all.

Wait!

The update adds additional and duplicate packages so I deleted ALL packages related to SQLite.Net Extensions. Re-added the SQLite.Net Extensions package only, it finds and adds the dependencies it needs. Build, run, all works.

That's why I assumed someone had updated the either/both packages.

blmiles avatar May 29 '17 11:05 blmiles

So I update SQLite.Net then delete all packages related to .Net Extensions then add the SQLite.Net Extensions separately?

ikiugu avatar May 29 '17 11:05 ikiugu

Update all SQLite related packages. Once done, check package list for duplicates but it should not harm removing all SQLite related packages then add SQLite.Net Extensions only. OR only SQLite.Net-PCL if you're not already using or intend to use SQLite.Net Extensions. No guarantee that'll help but that worked for me and eliminated that error.

blmiles avatar May 29 '17 13:05 blmiles

Okay, thanks. Let me try that.

ikiugu avatar May 29 '17 14:05 ikiugu