SQLite Forum

Using android AAR with modified sqlite_open_v2() - attach gives problems
Thanks for your considered answer. I appreciate it. I am just posting to follow up for completeness.

Yes, we did build the unmodified version first and that worked fine, confirming it is not our setup. 

We created a C-style function that accepts a db name, opens it, attaches a "shared" database file, installs a preupdate callback, and returns the open sqlite3* to the user. Relatively standard and works like a charm. The reason we want this is because our code needs both the "local" and the "shared" db present, and this is the method we prefer.

Then we compiled sqlite into a custom library where our function masks/replaces the existing sqlite3_open() and sqlite3_open_v2() functions _if_ the filename string starts with e.g. `ourthing://`. This works very well as well. (We happened to have done this using callbacks, but the above explains the intent.)

It stops working when we then involve the AAR and libsqliteX.so. Almost everything works _except_ the attach step.

As was suggested: our current work-around is to skip the attach step before returning the open sqlite3*. We then use the java interface to attach the shared db, and it seems to work nicely.

If we do figure out why this happens I'll make sure to post an update here. Thanks for the constructive replies.