2017-09-30 15 views
0

Xamarin Forms PortableプロジェクトでSqliteを使用しています。iOSUWPでアプリケーションを正常に実行しています。 Androidの場合、Android 6.0エミュレータでアプリケーションを実行できますが、Android Oreoではアプリがインストールされていても起動時にクラッシュします。私は次の問題に直面しています。Xamarinフォーム - Sqlite android Oreoランタイム.JavaProxyThrowable

問題:

android.runtime.JavaProxyThrowable:sqlite3_open_v2 (バイト[]、&のIntPtr、(ラッパーが管理対ネイティブ) SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroidInternalでINT、のIntPtr) でSQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroid.Open(System.Byte []ファイル名、SQLite.Net.Interop.IDbHandle & DB、 可能System.Int32フラグ、System.IntPtrのzvfs)[0x00000] in < 8dbf6f f85082469fb9d4dfaa9eae6b69>:0 SQLite.Net.SQLiteConnection..ctorで(SQLite.Net.Interop.ISQLitePlatform sqlitePlatform、可能System.String DatabasePathに、 SQLite.Net.Interop.SQLiteOpenFlags openFlags、可能System.Boolean storeDateTimeAsTicks、SQLite.Net。 IBlobSerializerシリアライザ、 2[TKey,TValue] tableMappings, System.Collections.Generic.IDictionary System.Collections.Generic.IDictionary 2 [処理鍵、TValue] extraTypeMappings、SQLite.Net.IContractResolverリゾルバ)0x000a2] < 8f2bb39aeff94a30a8628064be9c7efe>:0 SQLite.Net.SQLiteConnectionWithLock..ctorで( SQLite.Net.Interop.ISQLitePlatform sqlitePlatform、 SQLite.Net.SQLiteConnectionString connectionString、 System.Coll project.Models.Database + <> c__DisplayClass1_0で0 :< 8f2bb39aeff94a30a8628064be9c7efe>でections.Generic.IDictionary 2[TKey,TValue] tableMappings, System.Collections.Generic.IDictionary 2 [処理鍵、TValue] extraTypeMappings)0x0002e]。 SQLite.Net.Async.SQLiteAsyncConnection + <で0: < 563d605f9f014eeeb32fd4a27b4d142e> 0 でSQLite.Net.Async.SQLiteAsyncConnection.GetConnection()[0x00000]:< .ctor> b__0() [0x0001d] <で7df232f34ab8474d9153e3809af4eda8> > c__DisplayClass11_0.b__0 ()[0x00006]で< 563d605f9f014eeeb32fd4a27b4d142e>:0 System.Threading.Tasks.Taskで:0 System.Threading.Tasks.Task`1 [TResult] .InnerInvoke()[0x0000f] 中で.Execute()[0x00010] in : mono.java.lang.RunnableImplementor.n_run(ネイティブメソッド)at mono.java.lang.RunnableImplement or.run(RunnableImplementor.java:30) でandroid.os.Handler.dispatchMessage(Handler.java:98)でandroid.os.Handler.handleCallback(Handler.java:789)で
android.os.Looper .loop(Looper.java:164)at android.app.ActivityThread.main(ActivityThread.java:6541)at java.lang.reflect.Method.invoke(ネイティブメソッド)at com.android.internal.os。 Zygote $ MethodAndArgsCaller.run (Zygote.java:240)at com.android.internal.os.ZygoteInit.main (ZygoteInit。Javaの:接続を作成するために767)

public Database(string databaseName) 
     { 
      var pathToDatabaseFile = DependencyService.Get<Interfaces.ISQLite>().GetLocalPathToFile(databaseName); 
      var platform = DependencyService.Get<Interfaces.IPlatformProvider>().GetPlatform(); 

      _connection = new SQLiteAsyncConnection(() => 
      new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(pathToDatabaseFile, false))); 
      _connection.CreateTableAsync<SqlitePage>().Wait(); 
     } 
すべてのプロジェクト GetPlatform

GetLocalPathToFileが実装されています:

return new SQLitePlatformAndroid(); 

return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), fileName); 

をパッケージ私はSqliteを使用しています:

  • SQLite.Net.Async-PCL
  • SQLite.Net.Core-PCL
  • SQLite.Net-PCL

任意のアイデア?

答えて

0

Android 6以降では、一部の権限が変更されているため、sqlite-net-pclに変更する必要があります。

https://www.nuget.org/packages/sqlite-net-pcl/

私はこのPCLに切り替え、そしてすべてが魔法のように動作します。

関連する問題