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

SQLite3 not provided on Android N

Open alexvinidiktov opened this issue 9 years ago • 23 comments

https://developer.xamarin.com/releases/android/xamarin.android_6/xamarin.android_6.1/#mono-data-sqlite

Eric Sink also wrote about this: https://github.com/ericsink/SQLitePCL.raw/wiki/SQLite-net-and-Android-N

alexvinidiktov avatar Jun 21 '16 02:06 alexvinidiktov

Yep this is a very important update that's required. For reference, the repo this library forked from (praeclarum/sqlite-net) has already made the changes required: https://github.com/praeclarum/sqlite-net/commits/master

michaeldimoudis avatar Jun 21 '16 05:06 michaeldimoudis

Indeed, this seems like a big problem. So the solution would be to use SQLitePCL.raw/SQLitePCL.bundle_green/

oysteinkrog avatar Jun 24 '16 10:06 oysteinkrog

Thanks for the info. Do we have to wait for an updated Nuget package? Or can we just add the SQLitePCL.raw/SQLitePCL.bundle_green/ Nuget packages to our solution and it will just work?

michaeldimoudis avatar Jun 25 '16 13:06 michaeldimoudis

Do the SQLitePCL packages replace the packages? Or is this going to be updated for Nougat?

JaridKG avatar Jul 06 '16 20:07 JaridKG

Hi any news on this issue? I updated my Xamarin today (beta channel) and now I can't start the apps with SQLite anymore...

Any workaround for the time being other then reverting back to the older Xamarin versions?

bgmeiner avatar Aug 18 '16 11:08 bgmeiner

Same issue here. For now I downgraded back to the Xamarin release channel, but I think this will soon become a problem for lots of people once the beta goes to release.

philipag avatar Aug 18 '16 14:08 philipag

I just tested my Xamarin Forms app on Android 7.0 that uses: SQLite.Net-PCL SQLite.Net.Core-PCL SQLite.Net.Async-PCL

And it just works :)

michaeldimoudis avatar Aug 26 '16 01:08 michaeldimoudis

It does not work with the current Xamarin Android beta. Release is OK.

philipag avatar Aug 26 '16 16:08 philipag

I've switched the SQLite calls from the system SQLite to ericsink's Bundle_green embedded SQLite on my own fork of this project.

https://github.com/Machinarius/SQLite.Net-PCL https://www.nuget.org/packages/SQLite.Net-PCL-Green/3.1.1-AndroidN

Most tests pass and my app is behaving nicely with no warnings whatsoever regarding library usage on an Android Nougat emulator since i started using my fork instead of Oysten's nuget package.

Do handle with care and test your app thoroughly as i can NOT guarantee this simple string substitution trick will just work on all cases, mostly because the system SQLite library may be compiled with different flags. Also, the Nuget package was compiled using Oysten's master branch that may contain experimental code. DO TEST YOUR APP ON ANDROID N AND BELOW. DO IT. DON'T SKIP THIS STEP. PRETTY PLEASE DO NOT SKIP IT. YOU HAVE BEEN WARNED.

Machinarius avatar Aug 29 '16 19:08 Machinarius

As I understand, libsqlite.so will be:

  • still accessibile in Android N when targeting Android SDK 23 or less. It will only show a logcat error.
  • not accessibile in Android N when targeting Android SDK 24+
  • not accessibile in future releases of Android

https://developer.android.com/about/versions/nougat/android-7.0-changes.html

Is there any update about this issue? @oysteinkrog are you planning to update the package to be compliant with Android N and future releases?

admaiorastudio avatar Aug 30 '16 09:08 admaiorastudio

@admaiorastudio That's right. That is also discussed in the urls of the first post and here: http://android-developers.blogspot.nl/2016/06/improving-stability-with-private-cc.html

As @oysteinkrog didn't update this library since november 2015 I'll go look for another library, for example @Machinarius version.

renefloor avatar Aug 30 '16 09:08 renefloor

any updates on this? @oysteinkrog ?

SlyNet avatar Sep 12 '16 13:09 SlyNet

@Machinarius I tried to get your version working but I was unsuccessful. Do you have any pointers? Ie: what nuget packages to remove, if any, for yours to work? Any nuget packages I need to add extra? Any extra init() that has to happen like Batteries.init()? Any namespace changes? Thanks

michaeldimoudis avatar Sep 20 '16 21:09 michaeldimoudis

Switched over to sqlite-net-pcl and everything is working great. Had to change my connection code, but sqlite-net-pcl is actually a lot more simple to get a connection with.

Only issue I found is the there is no DeleteAllAsync() but that is not such a big deal for me.

hvaughan3 avatar Sep 25 '16 21:09 hvaughan3

Any news on this issue? @oysteinkrog

LuigiMaestrelli avatar Sep 29 '16 13:09 LuigiMaestrelli

we switched to sqlite-net-pcl.

SlyNet avatar Sep 29 '16 13:09 SlyNet

So is the solution - if we want our application to work on Android 7+ we need to swap to sqlite-net-pcl?

JKennedy24 avatar Oct 19 '16 10:10 JKennedy24

As long as this fork is not updated to also use SQLitePCLRaw: yes

MKuckert avatar Oct 19 '16 10:10 MKuckert

@MKuckert What about Sqlite.Net-Extensions? (Which I notice you are an owner of).

~~The Nuget has a dependency on Sqlite.Net-PCL. So if I use the Extensions nuget I am stuck on this version so cant run my application on Android 7+. Is that correct?~~

Actually scratch that, I notice you have swapped over in the Alpha releases

JKennedy24 avatar Oct 19 '16 10:10 JKennedy24

@michaeldimoudis I just tested my Xamarin Forms app on Android 7.0 that uses: SQLite.Net-PCL SQLite.Net.Core-PCL SQLite.Net.Async-PCL

And it just works :)

Tremendous solution and saved my day... Thanks...

Now it stopped working :(

PankitPatel avatar Nov 24 '16 10:11 PankitPatel

May be it just works because Android N is not denying access to the libsqlite.so - contrary to their beta versions. You should see some log messages pointing that out.

MKuckert avatar Nov 24 '16 19:11 MKuckert

Keep in mind that Android M will deny access to the native libraries, so although things might look to work for now they will break.

renefloor avatar Jan 17 '17 16:01 renefloor

Any new fix or workaround on this issue?

UnreachableCode avatar Sep 11 '18 09:09 UnreachableCode