skip to Main Content

I have a strange problem. I installed react-native-sqlite-storage like described on their docs (with autolinking and with the bundled SQLite, not androids SQLite, since it doesn’t support JSON functions). Now everything works fine on iOS (Simulator and Physical) and on Android (Physical). But only on Android Simulator (not on my Pixel 3a) I get following issue:
When running a basic query (which works on iOS and my Pixel 3a, but no on the Pixel 3a Sim) it just never returns anything when using :

print('Print 1')
await db.executeSql(`SELECT VALUE
                     FROM ${reportTableName}`); // Same happens with empty query: ''
print('Print 2')

Output (Pixel 3a Simulator):

Print 1

Output (Physical Pixel 3a, iOS Simulator, Physical iPhone):

Print 1
Print 2

Does anyone have an idea why this could be happening? It seems as if I’m the only one with this problem…

Simulator (also tried Pixel 4):
Device: Pixel 3a
Android Version: 12
Build Nr.: SE1A.220203.002.A1
React Native: v0.68.1
react-native-sqlite-storage: v6.0.1

2

Answers


  1. Chosen as BEST ANSWER

    Ok, was able to find the issue. After further inspecting the issue it seems to throw an error Invalid Database handle. After further investigation I found this solution. But this was not an option since I had to use the SQLite database bundled in the library (which this configuration handles) because I need FTS5 support for functions such as json_set().

    So instead I switched react-native-sqlite-2 which uses a newer version of sqlite. Problem fixed!


  2. For me the problem was when I’ve been trying inserting JavaScript object to the SQLite table. SQLite for iOS can handle this very well, but for unknown reason SQLite for Android not at all.

    More details: https://stackoverflow.com/a/73404423/11127383

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search