reactiveui / Akavache

An asynchronous, persistent key-value store created for writing desktop and mobile applications, based on SQLite3. Akavache is great for both storing important data as well as cached local data that expires.
https://evolve.xamarin.com/session/56e2044afd00c0253cae33a3
MIT License
2.42k stars 288 forks source link

Xamarin.Forms Droid application is crashing when trying to use Akavache #581

Open Nathan187 opened 4 years ago

Nathan187 commented 4 years ago

Describe the bug

I am trying to get an old Xamarin Forms application up and running. It's been pretty painful and on the verge of giving up. The application fails when trying to execute: await BlobCache.LocalMachine.Invalidate

This only happens when I try to run the droid version of the application. iOS works.

I am using Visual Studio for Mac 2019. I am using akavache 5.0. I can not use the latest version because the pcl project is using 'PCL profile 4.5 / Profile 78'. I can't update it because it's just going to shoot everything to crap. (Make it worse than it is now).

System.DllNotFoundException: /system/lib/libsqlite.so assembly: type: member:(null) at (wrapper managed-to-native) SQLitePCL.SQLite3Provider_default+NativeMethods.sqlite3_open_v2(byte[],intptr&,int,byte[]) at SQLitePCL.SQLite3Provider_default.SQLitePCL.ISQLite3Provider.sqlite3_open_v2 (System.String filename, System.IntPtr& db, System.Int32 flags, System.String vfs) [0x0000f] in <92150bc3982d421aa81ea9612e36b1d1>:0 at SQLitePCL.raw.sqlite3_open_v2 (System.String filename, SQLitePCL.sqlite3& db, System.Int32 flags, System.String vfs) [0x00000] in <92150bc3982d421aa81ea9612e36b1d1>:0 at Akavache.Sqlite3.Internal.SQLite3.Open (System.String filename, SQLitePCL.sqlite3& db, System.Int32 flags, System.IntPtr zVfs) [0x00000] in <62f381ebb54b44df949b4ae3da486002>:0 at Akavache.Sqlite3.Internal.SQLiteConnection..ctor (System.String databasePath, Akavache.Sqlite3.Internal.SQLiteOpenFlags openFlags, System.Boolean storeDateTimeAsTicks) [0x00030] in <62f381ebb54b44df949b4ae3da486002>:0 at Akavache.Sqlite3.Internal.SQLiteConnection..ctor (System.String databasePath, System.Boolean storeDateTimeAsTicks) [0x00000] in <62f381ebb54b44df949b4ae3da486002>:0 at Akavache.Sqlite3.SQLitePersistentBlobCache..ctor (System.String databaseFile, System.Reactive.Concurrency.IScheduler scheduler) [0x00026] in <62f381ebb54b44df949b4ae3da486002>:0 at Akavache.Sqlite3.Registrations+<>cDisplayClass6.b0 () [0x0004e] in <62f381ebb54b44df949b4ae3da486002>:0 at System.Lazy1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) [0x00043] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:333 at System.Lazy1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) [0x00022] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:351 at System.Lazy1[T].CreateValue () [0x00074] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:431 at System.Lazy1[T].get_Value () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:509 at Akavache.Sqlite3.Registrations+<>cDisplayClass6.b1 () [0x00000] in <62f381ebb54b44df949b4ae3da486002>:0 at Splat.ModernDependencyResolver.GetService (System.Type serviceType, System.String contract) [0x00039] in /Users/paul/code/paulcbetts/splat/Splat/ServiceLocation.cs:271 at Splat.DependencyResolverMixins.GetService[T] (Splat.IDependencyResolver This, System.String contract) [0x00000] in /Users/paul/code/paulcbetts/splat/Splat/ServiceLocation.cs:151 at Akavache.BlobCache.get_LocalMachine () [0x00000] in C:\projects\akavache\src\Akavache\Portable\BlobCache.cs:65 at Sir.SessionService.Login (System.Func`1[TResult] getAuthenticatedUser) [0x000c4] in /Users/n/Desktop/Source Code/SIR-Mobile/mobile/Sir/Services/SessionService.cs:77 at Sir.LoginViewModel.TryLogIn () [0x00039] in /Users/n/Desktop/Source Code/SIR-Mobile/mobile/Sir/ViewModels/LoginViewModel.cs:68

Expected behavior

Uh, I guess I'd like for it to work.

Screenshots

Environment

I have seen this has been a persistent issue for quite a while. I've added sql-net-pcl, etc.

Any other help/insight would be appreciated

open-collective-bot[bot] commented 4 years ago

Hey @Nathan187 :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.

https://opencollective.com/reactiveui

PS.: We offer priority support for all financial contributors. Don't forget to add priority label once you start contributing :smile:

ReactiveUI - Open Collective
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!
glennawatson commented 4 years ago

I can sympathize but not sure there is much we can do if your using that fairly old version.

I will give a go though. Looks like the native library libsqlite.so is not being found. You might want to match whatever is in akavache 5 and include the .so as a android native reference.

Nathan187 commented 4 years ago

do you know of a document or something that would describe how to do that? thanks for your response

glennawatson commented 4 years ago

https://docs.microsoft.com/en-us/xamarin/android/platform/native-libraries

Using Native Libraries - Xamarin
Nathan187 commented 4 years ago

thanks glen...i'm trying to hunt down that file .so file and i'll give it a shot

Nathan187 commented 4 years ago

i want to say thank you for answering and at least trying to help.

i actually got it to work. many post all suggest a common thing. remove all sqlite references/packages. when i uninstalled and reinstalled akavache 5.0, it dependent on some sqlite packages. i saw one person finding success when installing the SQLiteNetExtensions. That seems to have done the trick.

Sadly, I'm working on another issue now but it's further and less frustrated that where I was the other day.

Again, thanks for your help!