Unable to use installed database on Android


#1

I’m using a pre-built database and installing it on first-run using ReplaceDatabase. It loads and is functional on iOS, but using the same method on android is failing when we try to create our first view.

The code I am using for creating and loading the database is described in this post.

When I try to create a view, I am getting this nasty sqlite error:

    [Mono] Assembly Ref addref Couchbase.Lite[0xb7cddf78] -> System.Core[0xb7e8ccc0]: 11
[SQLiteLog] (11) database corruption at line 53693 of [00bb9c9ce4]
[SQLiteLog] (11) statement aborts at 5: [INSERT INTO views (name,version) VALUES (?,?)] database disk image is malformed
SqlitePCLRawStorageEngine: Error inserting into table views
    11: 
    SQLitePCL.Ugly.ugly+sqlite3_exception: Exception of type 'SQLitePCL.Ugly.ugly+sqlite3_exception' was thrown.
      at SQLitePCL.Ugly.ugly.step (SQLitePCL.sqlite3_stmt stmt) [0x00000] in <filename unknown>:0 
      at Couchbase.Lite.Shared.SqlitePCLRawStorageEngine.InsertWithOnConflict (System.String table, System.String nullColumnHack, Couchbase.Lite.Storage.ContentValues initialValues, ConflictResolutionStrategy conflictResolutionStrategy) [0x0005b] in /Users/borrrden/Development/couchbase-lite-net/src/Couchbase.Lite.Shared/Store/SqlitePclRawStorageEngine.cs:324 

I see a release note for version 1.0 of couchbase lite that claims this (or a similar issue) was fixed, but am at a complete loss on how to trouble shoot this.


#2

I’ll ask about this and get back to you


#3

When you created the snapshot, was there a WAL and SHM file? If so, they are needed for the database to work correctly.


#4

By the way, what version of Couchbase Lite are you using?


#5

I was unable to locate any wal or shm files. I’m guessing they would have been put next to the exported database or in the project folder somewhere if they were created.

We are using version 1.0.4.1 of the Xamarin Couchbase Lite plug in. Located here: http://components.xamarin.com/view/couchbase-lite-net/


#6

I’m still stuck on this. Any updates? I have a feeling it has to do with the attachments, but I am stripping out the android related prefix on the attachment streams and still getting that exception.


#7

If you can provide a minimal test case that reproduces this issue I can have a better look at it. I haven’t seen the error you are getting.


#8

It will take me a few days, but I will try to get a sample project setup that demonstrates the problem. Would you be able to open and run a Xamarin solution?


#9

Yes, I can run Xamarin solutions. Thanks!