Closed zesu2154 closed 2 years ago
@zesu2154 Can you try deleting the android folder from your app and do npx cap add android
npm run build
npx cap copy
and npx cap open android
i assume you are using database encryption and that you have set the secret? if it still does not work can you share your app or a small repro app of the issue so i could have a look. I never got that error.
@zesu2154 Any progress from your side ?
@jepiqueau Sorry, I am on a business trip and away from my usual development machine, will have to get to it when I get back to office next Tuesday. My apology for the delay.
@zesu2154 👍
I have the same problem. Try to delete android folder and recreate but without success. Seems to be a problem with security.
==============================
2021-11-24 09:06:51.445 4971-4971/it.filcronet.wasteassociator D/Capacitor: Registering plugin: WebView
2021-11-24 09:06:51.460 4971-4971/it.filcronet.wasteassociator D/Capacitor: Registering plugin: BarcodeScanner
2021-11-24 09:06:51.471 4971-4971/it.filcronet.wasteassociator D/Capacitor: Registering plugin: CapacitorSQLite
2021-11-24 09:06:51.944 4971-4971/it.filcronet.wasteassociator W/AndroidKeystoreAesGcm: encountered a potentially transient KeyStore error, will wait and retry
javax.crypto.AEADBadTagException
at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:517)
at javax.crypto.Cipher.doFinal(Cipher.java:2113)
at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decryptInternal(AndroidKeystoreAesGcm.java:115)
at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:97)
at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:206)
at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:107)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
at com.getcapacitor.community.database.sqlite.CapacitorSQLite.
============================================
I spent a lot of time but any solution found. Can Help us
@marcocrotti69 Can you share your app on github
Download it a this link https://www.dropbox.com/s/5cfphtbjf6jrqub/wasteAssociator.zip?dl=0. Thanks for you interest.
@zesu2154 @marcocrotti69 thanks for providing your example it help to shows the issue and fixes it. this is done in release 3.3.1 Please do the following
npm i --save @capacitor/core@3.3.1
npm i --save @capacitor/android@3.3.1
npm i --save-dev @capacitor/cli@3.3.1
npm i --save @capacitor-community/sqlite@3.3.1
which put everything at the same level and then
npx cap sync
npm run build
npx cap copy
npx cap open android
Please close the issue if it works for you. Thanks again
Tried your solution without luck.
==============================================
2021-11-25 10:10:49.826 19270-19270/it.filcronet.wasteassociator D/Capacitor: Starting BridgeActivity
2021-11-25 10:10:49.874 19270-19270/it.filcronet.wasteassociator D/Capacitor: Registering plugin: WebView
2021-11-25 10:10:49.888 19270-19270/it.filcronet.wasteassociator D/Capacitor: Registering plugin: CapacitorSQLite
2021-11-25 10:10:50.252 19270-19270/it.filcronet.wasteassociator W/AndroidKeystoreAesGcm: encountered a potentially transient KeyStore error, will wait and retry
javax.crypto.AEADBadTagException
at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:517)
at javax.crypto.Cipher.doFinal(Cipher.java:2113)
at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decryptInternal(AndroidKeystoreAesGcm.java:115)
at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:97)
at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:206)
at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:107)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:155)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
at com.getcapacitor.community.database.sqlite.CapacitorSQLite.
===========================================================
This is my package,json: { "name": "wasteAssociator", "version": "0.0.1", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "~12.1.1", "@angular/core": "~12.1.1", "@angular/forms": "~12.1.1", "@angular/platform-browser": "~12.1.1", "@angular/platform-browser-dynamic": "~12.1.1", "@angular/router": "~12.1.1", "@capacitor-community/barcode-scanner": "^2.0.1", "@capacitor-community/sqlite": "^3.3.1", "@capacitor/android": "^3.3.1", "@capacitor/app": "^1.0.6", "@capacitor/core": "^3.3.1", "@capacitor/geolocation": "^1.2.0", "@capacitor/haptics": "^1.1.3", "@capacitor/keyboard": "^1.1.3", "@capacitor/status-bar": "^1.0.6", "@capacitor/storage": "^1.2.3", "@ionic/angular": "^5.8.5", "jeep-sqlite": "^1.3.2", "rxjs": "~6.6.0", "tslib": "^2.2.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~12.1.1", "@angular-eslint/builder": "~12.0.0", "@angular-eslint/eslint-plugin": "~12.0.0", "@angular-eslint/eslint-plugin-template": "~12.0.0", "@angular-eslint/template-parser": "~12.0.0", "@angular/cli": "~12.1.1", "@angular/compiler": "~12.1.1", "@angular/compiler-cli": "~12.1.1", "@angular/language-service": "~12.0.1", "@capacitor/cli": "^3.3.1", "@ionic/angular-toolkit": "^4.0.0", "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "4.16.1", "@typescript-eslint/parser": "4.16.1", "eslint": "^7.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-prefer-arrow": "1.2.2", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.2", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "protractor": "~7.0.0", "ts-node": "~8.3.0", "typescript": "~4.2.4" }, "description": "An Ionic project" }
I have also deleted all folder (www, andoird, node_modules) and regenerate all resources but won't work.
Thacks
I have used this trick. Changing the package name i resolved the error. I think that: the phone register some information (i don't know where) and also if i remove the app that information aren't cleared. For the moment the app it's ok. Thanks a lot.
@marcocrotti69 I do not really understand what is going on. i download your app, install it, build it and when running it getting the same error, then i delete the app from the physical device and made the modifications, remove the android folder and then did exactly what i mentioned earlier and it works fine. i test it on API21 device. i will close the issue
Sorry for being late in getting back here.
I cannot reproduce using a small sample app. It runs without problem.
@marcocrotti69 So you just change the package name from something like com.example.app to com.example.app2, and everything is ok??
And the weird thing is it works fine with Android 11 simulator, Android 10 real device, various ios devices. Just failed with Android 11 real devices.
I am have a similar issue. I am getting an error of "Msg: Uncaught (in promise) Error: isDatabase: Attempt to invoke virtual method" on my device but not the simulator. To fix it I have to drop the android folder and change the appId in the capacitor.config.ts file.
The problem with this is now I can't use the original appID. If repeat the process with the original appId the error comes back on my device.
**Update After looking into possible issues with caching of android studio and Gradle, I decided to revert the appId back to the original id. After restarting android studio everything looks to working properly and no more error messages.
I was fighting with exact the same problem for some days. The problems occurred on two different Android devices (Android 8.1 and Android 12) after several app updates and for two different users. Our app is also running on iOS, but there we don't have any problems. We are using:
Even after an uninstall and reinstall, the plugin throws the mentioned error (W/AndroidKeystoreAesGcm: encountered a potentially....).
Today I found out that this is caused by the automatic backups of app data via android. I could (partially) solve the problem by disabling backups in AndroidManifest with: android:allowBackup="false"
and then after I uninstalled and reinstalled the new version, the problem was gone! Maybe this helps someone too.
Thanks, It's worked for me... :)
Thanks, It's worked for me... :)**** x2
I had too that error
I had been using the plugin and had been successful in building/running that on both simulator/real device.
However, this popup last night, while the app runs on emulator and also on a real Android 10 device.
I used Android Studio and captured the run log, it seems that there is an exception when Capacitor register the sqlite plugin, please see below for the relavant log entries.
=========================================
=========================================
And I also attached an ionic info printout as well
Ionic:
Ionic CLI : 6.18.1 (/Users/XXX/.nvm/versions/node/v16.13.0/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.8.5 @angular-devkit/build-angular : 12.1.4 @angular-devkit/schematics : 12.2.13 @angular/cli : 12.1.4 @ionic/angular-toolkit : 4.0.0
Capacitor:
Capacitor CLI : 3.3.1 @capacitor/android : 3.3.1 @capacitor/core : 3.3.1 @capacitor/ios : 3.3.1
Utility:
cordova-res : not installed globally native-run : 1.5.0
System:
NodeJS : v16.13.0 (/Users/XXX/.nvm/versions/node/v16.13.0/bin/node) npm : 7.24.2 OS : macOS Big Sur
=========================================
Not sure what's gone wrong, the only thing that I can think of is there may be an update to the capacitor. I believe I had tried to set all the capacitor version to 3.2.5, and if I remember correctly, the same error still persists.
Regards