-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android SDK Target 30 + OPEN database: x FAILED #954
Comments
@brodybits sorry to tag directly, but do you have any idea what could be causing this? I've noticed if I provide androidDatabaseProvider: 'system', it begins to work again however I'm using Ionic Storage and don't have that level of control / flexibility. I've also tried to go direct and use the SQLite plugin and bypass the Ionic Storage code, but the data that was once stored in SQLite no longer exists, I'm assuming because a different provider is used... |
I am also facing the same issue on Android 11 (Api 30) however it works fine for (API 29). following code returns negative int value Due to which https://github.com/liteglue/Android-sqlite-connector/blob/master/src/io/liteglue/SQLiteGlueConnection.java |
It's the same issue reported here: brodycj/cordova-sqlite-storage-dependencies#3 The plugin is not working as expected on Android 11 devices. |
The current version of the plugin is not able to open databases when targeting the SDK 30 and running on devices with Android 11. The issue was already reported brodycj/cordova-sqlite-storage-dependencies#3 and storesafe#954 From what I was able to understand, it is related with the permissions changes on Android 11, where the SQLite is unable to open the database file using native C primitive `sqlite3_open_v2`: https://github.com/liteglue/Android-sqlite-connector/blob/master/src/io/liteglue/SQLGDatabaseHandle.java#L14 https://github.com/liteglue/Android-sqlite-connector/blob/master/src/io/liteglue/SQLiteNative.java#L60 https://github.com/liteglue/Android-sqlite-native-driver/blob/master/native/sqlc.c#L40 causing the handler to crash with a NullPointerException when throwing an exception https://github.com/liteglue/Android-sqlite-connector/blob/master/src/io/liteglue/SQLiteGlueConnection.java#L12 Summing up, this hotfix will enable the usage of the default Android database provider for Android 11 only, by setting the `oldImpl` to `true`, which is the same behaviour of using the `androidDatabaseProvider: 'system'` setting at the javascript side. References https://outsystemsrd.atlassian.net/browse/RNMT-4515
Thanks for reporting, I will investigate this in the near future. I will also investigate if this is an issue in cordova-sqlcipher-adapter, which is always using a custom SQLCipher build also based on SQLite. |
@brodybits @jfrumar Has this issue been addressed? We are also seeing the same problem. Thanks! |
Hi. Same here. Is there work planned on this ? Given the merged fork at OutSystems/Android-sqlite-native-driver#1 + the sqlcipher investigation above. Thanks |
Thanks for the ping, I will definitely work on this with high priority. Please ping me if you do not see progress in the next 2-3 weeks. |
I tried Android SDK 30 together with Android 11 from this branch of I am able to use the buttons to add record and show record count still with no problems on an Android 11 emulator. I may need a some time to obtain an Android 11 device for further testing.
This error indicates to me that the app opens a database and immediately starts one or more transactions. I recommend that you consider waiting for the openDatabase success callback as documented. |
Hey! I'm hoping I can chip in with some useful info but take this with a pinch of salt as I've not sanity checked this. When setting the targetSDK to 30 as the author mentions it would fail to open the database on Android 11. It wouldn't happen on all devices though. We saw it on the latest generation of Pixels most notably so the 4A, 4A (5G) and 5. We tried the Pixel 4 & 3A and they worked fine. All devices tested were on A11. Sorry I know that's probably not much use but hopefully helps a little 😅 |
I can confirm that setting the Target API to 29 does indeed solve the problem. Using the callback does not - it will in fact call the error callback, though it is still best practices to do this anyway and I'd recommend implementing it this way when possible. I'm not sure what actually triggers it though as indeed, I tested on numerous Android 11 devices with no issue except it fails on the Galaxy S20+. |
I have the same problem. Since August 2021, google has required SDK30 support. So I don't think it's very good to lower the sdk version. |
I can confirm that the issue also happens on the Samsung S21 Ultra 5G and the Xiaomi Mi Note 10. I'd love to avoid lowering the target SDK if in any way possible. |
@brodybits Everythinkg worked fine before SDK30 / Android 11.
You could use 30 Mintues for free at https://www.browserstack.com using a real remote device. You just need to upload the APK and can choose between lots of real devices. For OpenSource projects like yours, you can ask for the OpenSource program to get a free full lifetime access: I tried a lot these days, also to reproduce the bug in your test app. After a long time trying and getting crazy, I have found the problem: There was a typo in your test app. I created a PR brodycj/cordova-sqlite-test-app#7 and hope you can fix the problem soon, as i really do not want to drop your plugin from my project as i have to create a new release of my app soon. Maybe you can work together or be inspired by the guys of |
Additional Debug Information:
|
@magynhard you should see that I have already merged your PR on the test app. I did reach out to browserstack.com for the open source testing and hope to end up with some positive results. It looks to me like OutSystems solved it by using a complex type in the NDK library, and I am thinking about incorporating their updates if I can get some confirmation from others that it will actually solve this problem. The one thing is that they have dropped Android 5.1 support, which I am not yet ready to do on this plugin. |
Another quick update: Browser Stack has approved me for the open source testing for 1 year. Thanks to @magynhard for the suggestion! I will start using Browser Stack to test on multiple Android 11 devices. I will try both the existing plugin and a version with the fixes from OutSystems#9. I may need a few days to have some meaningful results worth posting. Any input from the user community would be much appreciated on this issue. |
Hello guys, |
Thanks! I have tested on Pixel 5 with help from Browser Stack, reproduced the issue, and it seems to be solved by the OutSystems fork. I would like to do some more testing before updating this plugin. P.S. I tested the OutSystems fork from here: https://github.com/brodybits/cordova-sqlite-test-app/tree/android-sdk-30-outsystems-fork-test P.P.S. The actual solution is in the following PRs:
The details are in the commit message of this commit: OutSystems/Android-sqlite-native-driver@6a19159 P.S. 3: Adding reference to a corresponding discussion on cordova-android: apache/cordova-android#1006 Planning to bump the default Android SDK Target to 30, but not until cordova-android 10.0.0. |
Remove Platform Android and add platform again with version tag to latest
|
@abhiways Thank you for the suggestion. |
I am also seeing similar issue as @KishanDasani for cordova-android 10.0.0 with 6.0.0 |
@brodybits Getting this issue for Andoroid platform version 8.1.0 and "cordova-sqlite-storage": "^6.0.0" ```
|
@brodybits |
Please check the following:
Completely remove both I would also recommend removing configuration of Cordova platform versions. Then do |
Same issue here I'm using version 6.0.0 with android 11 (sdk 30) And the status is "cant open database" only on some physical phones (samsung s21 or xiami redmi 9) but on emulator works Ionic: Ionic CLI : 5.4.16 Cordova: Cordova CLI : 10.0.0 (cordova-lib@10.1.0) Utility: cordova-res : 0.15.3 System: Android SDK Tools : 26.1.1 (/Users/exequielcatalani/Library/Android/sdk) |
Thank you for your reply @brodybits |
@KishanDasani Did you find any other solution?? |
Hi, @Afridi1288 |
Hello I am also having the same problem, Android 11 and cordova-sqlite-plugin 6.0.0. Already removed and installed platforms and plugins, but my screen just shows a white screen and throws the error ""OPEN database: _ionicstorage FAILED, aborting any pending transactions" " |
See #991 (comment):
|
These steps worked AFTER I deleted my local repo and then ran Ionic: Ionic CLI : 6.13.1 (/usr/local/lib/node_modules/@ionic/cli) We pushed a new app version with API 30 and some android users had a white screen when launching app. Previous versions worked for them until API 30. Running the above steps on a fresh repo worked and allowed us to get a new build into production. |
Hey mate, I tried this, but unfortunately this didn't even work. Ionic: Ionic CLI : 3.9.0 |
Hello @gerhartz What do you mean "deleted my local repo" . Can you provide exact steps. I am also facing same issue and applied all above steps did not solve issue. Pain is that it is happening on release version only. debug version work well everywhere. These seems known issue with Android 11. Kindly, help with steps you followed to solve issue. |
I mean I cloned a copy of my problematic github repo into a new project and
ran: cordova platform add android@latest on that new project
…On Tue, Nov 30, 2021 at 9:29 AM Balkrishna Verma ***@***.***> wrote:
Hello @gerhartz <https://github.com/gerhartz> What do you mean "deleted
my local repo" . Can you provide exact steps. I am also facing same issue
and applied all above steps did not solve issue. Pain is that it is
happening on release version only. debug version work well everywhere.
These seems known issue with Android 11. Kindly, help with steps you
followed to solve issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#954 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADYPKNFIFQWNEREZTNEXLLDUOTUW3ANCNFSM4SBPEQHA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Thanks @gerhartz for quick response. My issue is resolved some other way. I just uninstalled plugin to resolve this issue. This may not be ideal solution for everyone. For me cordova-sqlite-storage plugin was only used to support ionic storage. In absence of this plugin ionic storage will use localstorage instead or indexdb whichever is available. Uninstall plugin |
We've faced this issue in production, after changing from API level 29 to 30 due to recent Google requirements. The app was opening with a blank screen but only for some users with Android 11 (phone model Samsung Galaxy A71 appeared to be most affected, also Pixel 5). The app is old, Ionic v4 with Angular 8.1... No "application error" message, only blank screen (admob ads on native activities worked fine nonetheless, which made users get mad and submit 1-star reviews). After digging into logcat for hours, we found the "OPEN database: _ionicstorage FAILED, aborting any pending transactions" error along with: |
Unsure removing the plugin is a good idea @mantovanigo @krishna711 Otherwise you could fall into the pitfalls mentionned here https://ionicframework.com/docs/v3/storage/ (if you drop sqlite) |
This is what worked for me.
|
Hi there, My issue got resolved when I modified my proguard file with some SQL classes. |
For anyone still running into this issue, I've been fighting with it for far too long but I have come to a solution. The issue is on physical android 11 and 12 devices (I haven't tested lower). The fix is in version 6.0.0, but was only seen after deleting any prior project files. Our project is a large code base, so while you might encounter a better solution, this worked for me.
Hope that helps. |
Hello,
Setting the target android SDK value to 30 results in the (normally working fine) plugin to fail when opening the database.
"OPEN database: _ionicstorage FAILED, aborting any pending transactions"
If I set the SDK value to < 30, it suddenly starts working again.
Cordova: 10
Android: 9
Ionic Storage: 2.3.1
Cordova SQLite Storage: 5.1.0
Thanks
The text was updated successfully, but these errors were encountered: