Here we are again. After upgrading MAUI to version 8.0.82, when I deploy my application on an Android device, I get this error
Maui error Javax.Crypto.AEADBadTagException
If you run the application in an Android Emulator, the application is working normally and you can’t get this issue.
What can it be?
From what I read on the internet, the issue is related to the SecureStorage
. This is if you use the MAUI Essentials. The issue could have come from this component based on the latest changes.
Check if under the Android platform under the XML
folder, you have this auto_backup_rules.xml
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="${applicationId}.mauiessentials.xml"/>
</full-backup-content>
On GitHub, I read that the workaround is to set to False
in the AndroidManifest
the backup like that
<application android:allowBackup="false"
android:fullBackupContent="@xml/auto_backup_rules"
android:icon="@mipmap/appicon" android:supportsRtl="true"
android:label="Language In Use"
android:dataExtractionRules="@xml/appcenter_backup_rule">
but I continue to receive the message and I can’t run the application. Checking the preview documentation, I read I have to update also the auto_backup_rules.xml like the following
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref"
path="${applicationId}.microsoft.maui.essentials.preferences.xml"/>
</full-backup-content>
Also, this is not working.
Workaround
After a lot of trials, setting android:allowBackup="false"
was enough to fix the issue. It is not necessary to do anything else. The important thing is you have to remove the app from your device before deploying the application again.
If you deploy the application and it exists on the phone, probably the app won’t work.
Conclusion
Please let me know if this is working for you or if you have any other workaround.