Closed jumamfa closed 3 years ago
@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). Here is my analysis:
following code returns negative int value SQLiteNative.sqlc_db_open(this.dbfilename, this.openflags) in file https://github.com/liteglue/Android-sqlite-connector/blob/master/src/io/liteglue/SQLGDatabaseHandle.java Line 14
Due to which https://github.com/liteglue/Android-sqlite-connector/blob/master/src/io/liteglue/SQLiteGlueConnection.java line 12 throws Error.
It's the same issue reported here: https://github.com/storesafe/cordova-sqlite-storage-dependencies/issues/3
The plugin is not working as expected on Android 11 devices.
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 https://github.com/OutSystems/Android-sqlite-native-driver/pull/1 + the sqlcipher investigation above.
Thanks @brodybits
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 cordova-sqlite-test-app
: https://github.com/brodybits/cordova-sqlite-test-app/tree/android-sdk-30-test
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.
"OPEN database: _ionicstorage FAILED, aborting any pending transactions"
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. DB error occurs on Pixcel 4a (android11). If it is a simulator, no error will occur.
Since August 2021, google has required SDK30 support. So I don't think it's very good to lower the sdk version. https://developer.android.com/distribute/best-practices/develop/target-sdk
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 Also having the same problem, just by initializing the DB and read some data.
Everythinkg worked fine before SDK30 / Android 11.
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.
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: https://www.browserstack.com/open-source
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 https://github.com/brodybits/cordova-sqlite-test-app/pull/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 https://github.com/OutSystems/Cordova-sqlite-storage/pull/7 https://github.com/OutSystems/Cordova-sqlite-storage/pull/8 https://github.com/OutSystems/Cordova-sqlite-storage/pull/9
Additional Debug Information:
03-19 12:44:53.121 E/SQLitePlugin(16860): unexpected error, stopping db thread
03-19 12:44:53.121 E/SQLitePlugin(16860): java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String io.liteglue.SQLDatabaseHandle.getLastErrorMessage()' on a null object reference
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.liteglue.SQLiteGlueConnection.<init>(SQLiteGlueConnection.java:12)
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.liteglue.SQLiteConnector.newSQLiteConnection(SQLiteConnector.java:20)
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.sqlc.SQLiteConnectorDatabase.open(SQLiteConnectorDatabase.java:55)
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.sqlc.SQLitePlugin.openDatabase(SQLitePlugin.java:213)
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.sqlc.SQLitePlugin.access$000(SQLitePlugin.java:28)
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.sqlc.SQLitePlugin$DBRunner.run(SQLitePlugin.java:328)
03-19 12:44:53.121 E/SQLitePlugin(16860): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-19 12:44:53.121 E/SQLitePlugin(16860): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-19 12:44:53.121 E/SQLitePlugin(16860): at java.lang.Thread.run(Thread.java:923)
@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, I can confirm you that https://github.com/OutSystems/Cordova-sqlite-storage/pull/9 fixed the issue with Android 11 devices.
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: https://github.com/OutSystems/Android-sqlite-native-driver/commit/6a19159e9fd8bfd0b995b61511444b4a71e9f3bb
P.S. 3: Adding reference to a corresponding discussion on cordova-android: https://github.com/apache/cordova-android/issues/1006
Planning to bump the default Android SDK Target to 30, but not until cordova-android 10.0.0.
I have just published version 6.0.0 with the enhancements to the Android JAR libraries from OutSystems. This issue should be resolved now.
@brodybits thank you very much for your fast reaction.
I will check it and give some feedback.
Where can i find the button to donate a coffe to you?
@magynhard please keep me posted. I may be a little slow for the next 1-2 weeks but would definitely love to know the result.
Your suggestion to use Browser Stack was already good payment for this update, and I have already suggested to Apache Cordova to start using it as well. I think many others will benefit from this update over time. But here is my PayPal address if you insist: payments@brodysoft.com
Thanks for the tip, time for a good coffee!
@brodybits after updating the plugin dependency to 6.0.0 everything is working fine with android 11 ๐๐ป
... and Android SDK Target 30 ... right?
Yeah ๐ ๐
๐ธ Of course SDK target 30! ๐
Otherwise i would not have been able to release any new version with your active plugin at android 11 on the play store ๐ฑ You saved my release deadline next week โ
Thanks for the fix, @brodybits .
Hat tip should go to @luissilvaos. You are welcome!
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 am finding the same thing: works fine on Pixel 2, and Samsung S20, but fails on Pixel 4a and Pixel 5
The most recent version of cordova-sqlite-storage should now be working on Pixel 4a and 5. If not, please raise a new issue with a minimal reproduction. Thanks.
@brodybits , Hi, I have the same problem still. Additional Debug Information:
E/SQLitePlugin: unexpected error, stopping db thread java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String io.liteglue.a.e()' on a null object reference at io.liteglue.f.<init>(SourceFile:12) at io.liteglue.e.a(SourceFile:20) at io.sqlc.b.a(SourceFile:57) at io.sqlc.SQLitePlugin.a(SourceFile:220) at io.sqlc.SQLitePlugin.a(SourceFile:30) at io.sqlc.SQLitePlugin$d.run(SourceFile:335) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923)
Samsung Galaxy S10+๏ผ Android 11๏ผtargetSdkVersion๏ผ30 cordova-sqlite-storage 6.0.0 "Cordova SQLite storage plugin - cordova-sqlite-storage plugin version"
Any good suggestions? Thanks!
A** saved thanks..
Hello there,
Facing the same issue with cordova-sqlite-storage version 5.1.0.
But when updated to newest version i.e 6.0.0 this happens. (snapshot attached)
Also, please note that this behaviour happens on signed release apk, not on debug apk.
Remove Platform Android and add platform again with version tag to latest
ionic cordova platform add android@10
>> For ionic
@abhiways Thank you for the suggestion. But this didn't helped I tried cordova-android 10.0.0 with both plugin versions i.e. 5.1.0 and 6.0.0.
I am also seeing similar issue as @KishanDasani for cordova-android 10.0.0 with 6.0.0 Application Error - The connection to server was unsuccessful.
@brodybits Getting this issue for Andoroid platform version 8.1.0 and "cordova-sqlite-storage": "^6.0.0" ```
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String io.liteglue.SQLDatabaseHandle.getLastErrorMessage()' on a null object reference
03-19 12:44:53.121 E/SQLitePlugin(16860): at io.liteglue.SQLiteGlueConnection.
@brodybits Sorry to tag directly But can you kindly look into this? as we are in November and target to API 30 is must
Please check the following:
package.json
config.xml
cordova-sqlite-storage
version (6.0.0
at this point)Completely remove both plugins
and platforms
directories from your workarea.
I would also recommend removing configuration of Cordova platform versions.
Then do cordova platform add android@latest
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 Ionic Framework : @ionic/angular 4.11.7 @angular-devkit/build-angular : 12.2.13 @angular-devkit/schematics : 12.2.13 @angular/cli : 9.1.13 @ionic/angular-toolkit : 4.0.0
Cordova:
Cordova CLI : 10.0.0 (cordova-lib@10.1.0) Cordova Platforms : android 10.1.1, ios 6.1.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 20 other plugins)
Utility:
cordova-res : 0.15.3 native-run (update available: 1.5.0) : 1.4.0
System:
Android SDK Tools : 26.1.1 (/Users/exequielcatalani/Library/Android/sdk) ios-sim : 8.0.2 NodeJS : v14.17.0 (/usr/local/bin/node) npm : 6.14.13 OS : macOS Big Sur Xcode : Xcode 13.1 Build version 13A1030d
Please check the following:
- all plugins are configured in
package.json
- no plugins are listed in
config.xml
- you are using latest
cordova-sqlite-storage
version (6.0.0
at this point)- no other SQLite plugin versions are configured
Completely remove both
plugins
andplatforms
directories from your workarea.I would also recommend removing configuration of Cordova platform versions.
Then do
cordova platform add android@latest
Thank you for your reply @brodybits I've tried this. Unfortunately, this didn't even help.
@brodybits Facing the same issue. Release build with cordova-sqlite-storage v6.0.0 is crashing. Please help to fix this issue.
Please check the following:
- all plugins are configured in
package.json
- no plugins are listed in
config.xml
- you are using latest
cordova-sqlite-storage
version (6.0.0
at this point)- no other SQLite plugin versions are configured
Completely remove both
plugins
andplatforms
directories from your workarea. I would also recommend removing configuration of Cordova platform versions. Then docordova platform add android@latest
Thank you for your reply @brodybits I've tried this. Unfortunately, this didn't even help.
@KishanDasani Did you find any other solution??
Please check the following:
- all plugins are configured in
package.json
- no plugins are listed in
config.xml
- you are using latest
cordova-sqlite-storage
version (6.0.0
at this point)- no other SQLite plugin versions are configured
Completely remove both
plugins
andplatforms
directories from your workarea. I would also recommend removing configuration of Cordova platform versions. Then docordova platform add android@latest
Thank you for your reply @brodybits I've tried this. Unfortunately, this didn't even help.
@KishanDasani Did you find any other solution??
Hi, @Afridi1288 Not yet, this has become a headache for some days.
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 https://github.com/storesafe/cordova-sqlite-storage/issues/991#issuecomment-966627745:
I am now wondering if this may have something to do with Ionic. In general, Apache Cordova, this plugin, and other plugins expect the JavaScript to wait for the
deviceready
event before attempting any plugin access. But I have seen issues before where things started breaking with newer frameworks and devices.I would recommend an approach of starting with a new Ionic project and trying one thing at a time to see what does and does not work with the newer Android versions.
Please check the following:
all plugins are configured in package.json no plugins are listed in config.xml you are using latest cordova-sqlite-storage version (6.0.0 at this point) no other SQLite plugin versions are configured Completely remove both plugins and platforms directories from your workarea.
I would also recommend removing configuration of Cordova platform versions.
Then do cordova platform add android@latest
These steps worked AFTER I deleted my local repo and then ran cordova platform add android@latest
on a fresh local copy worked for me. Trying to uninstall/reinstall cordova plugins on my original repo did not work.
Ionic:
Ionic CLI : 6.13.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.6.3 @angular-devkit/build-angular : 0.1001.7 @angular-devkit/schematics : 10.2.3 @angular/cli : 10.2.3 @ionic/angular-toolkit : 2.3.3
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.
Please check the following: all plugins are configured in package.json no plugins are listed in config.xml you are using latest cordova-sqlite-storage version (6.0.0 at this point) no other SQLite plugin versions are configured Completely remove both plugins and platforms directories from your workarea. I would also recommend removing configuration of Cordova platform versions. Then do cordova platform add android@latest
These steps worked AFTER I deleted my local repo and then ran
cordova platform add android@latest
on a fresh local copy worked for me. Trying to uninstall/reinstall cordova plugins on my original repo did not work. Ionic: Ionic CLI : 6.13.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.6.3 @angular-devkit/build-angular : 0.1001.7 @angular-devkit/schematics : 10.2.3 @angular/cli : 10.2.3 @ionic/angular-toolkit : 2.3.3 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 Ionic Framework : @ionic/angular 3.9.10 @angular/cli : 1.2.5
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 https://github.com/storesafe/cordova-sqlite-storage/issues/954#issuecomment-982746003, 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 Remove android platform Add android platform again
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