andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.75k stars 521 forks source link

Patch and update the android native libraries for API 30 #494

Open rubenmaas opened 2 years ago

rubenmaas commented 2 years ago

Our team previously added these libraries to react-native-sqlite-storage. Now we've patched and updated the libs for Android API 30. We've tested it with JSON queries as well.

Fix for this issue: https://github.com/andpor/react-native-sqlite-storage/issues/462

MarkCSmith commented 2 years ago

Where can we find the source code that was used to build these binaries?

octavezero commented 2 years ago

The sqlite library and connector code is from here (The existing binaries are also build from here) - https://github.com/liteglue/Android-sqlite-connector and https://github.com/brodybits/Android-sqlite-ext-native-driver

The Android 11 patches are from these Cordova libraries - https://github.com/OutSystems/Android-sqlite-connector/pull/1 and https://github.com/OutSystems/Android-sqlite-native-driver/pull/1

osmaa commented 2 years ago

Would you please include the actual upstream revision reference, as it seems impossible to determine which sqlite3 version is actually bundled? Or better yet, enable us to build the same version from source code by submoduling the revision you include. They way you document this, we have to take at face value that an undocumented bundled binary is safe with no way of verifying where it in fact came from.

octavezero commented 2 years ago

Sure. You can checkout the actual sqlite (and included plugin) upstream submodule revisions from here - https://github.com/brodybits/Android-sqlite-ext-native-driver. All of these are build from sources with no binaries involved.

The core sqlite submodule is here - https://github.com/liteglue/sqlite-amalgamation/tree/8266a49e2d49deb42422f9b48f49fe94c73971e2, where you can verify the sqlite source from the origin (https://www.sqlite.org/2020/sqlite-amalgamation-3320300.zip). You can similarly verify the sources for the other submodules.

Also, the build instructions are provided in the connector and driver repos. You can easily rebuild the binaries for verification by following those steps. The only modifications made are the two Android 11 patches from the listed PR, which you can manually apply.

tszajna0 commented 2 years ago

You may need to add to your proguard-rules.pro

-keep class io.liteglue.** { *; }
andpor commented 2 years ago

I will merge this in this upcoming week. I am getting new hardware and it is taking a while to ship. Can you confirm that the libraries are backward compatible, json1 support included and povide instructions how to build them. Many thanks.

FatemeMirzaeii commented 2 years ago

I will merge this in this upcoming week. I am getting new hardware and it is taking a while to ship. Can you confirm that the libraries are backward compatible, json1 support included and povide instructions how to build them. Many thanks.

can you tell us when do you want to merge this PR?

will-tsang commented 2 years ago

App crashes in run time

@castalonirenz, have you try adding the proguard rule mentioned by @tszajna0 https://github.com/andpor/react-native-sqlite-storage/pull/494#issuecomment-975822945

creekorful commented 1 year ago

I will merge this in this upcoming week. I am getting new hardware and it is taking a while to ship. Can you confirm that the libraries are backward compatible, json1 support included and povide instructions how to build them. Many thanks.

Hi @andpor. Any news on this?

bwmarrin commented 1 year ago

I'm trying to use the this PR to solve the Android 11 issue but I'm getting the below error message when testing. If anyone else has run into this error and has a solution I would appreciate any advise. Thanks. I'm testing on a Pixel 1 with Android 10 with ReactNative 0.63

2022-10-03 11:01:01.927 26878-26937/? runtime.cc:638] JNI DETECTED ERROR IN APPLICATION: mid == null
2022-10-03 11:01:02.072 26943-26943/? A/DEBUG: Abort message: 'JNI DETECTED ERROR IN APPLICATION: mid == null
        in call to NewObject
        from io.liteglue.SQLiteResponse io.liteglue.SQLiteNative.sqlc_db_open(java.lang.String, int)
usmanmalik333 commented 1 year ago

any solution to this issue ? if i removed the dependencies then it not worked in other android versions.

hengkx commented 1 year ago

Thank you very much for your current normal operation