I've been attempting to follow along with the instructions on the Android Auto Backup documentation page. I keep hitting errors that prevent me from completing a backup of my app.
First, I added the following two lines to my AndroidManifest:
<application
...
android:allowBackup="true"
android:fullBackupContent="@xml/my_backup_rules"
...
</application>
I created a my_backup_rules.xml file in android/app/src/main/res/xml with the following lines:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="file" path="db.realm" />
</full-backup-content>
According to Android Studio, the db.realm file is rather large at 18MB, so this is the only file I'm planning to include in the backup to remain within the 25MB backup quota.
Following the test documentation, I ran adb shell bmgr list transports and saw the following output:
* daemon started successfully
com.android.localtransport/.LocalTransport
com.google.android.gms/.backup.migrate.service.D2dTransport
* com.google.android.gms/.backup.BackupTransportService
However, when I run the next test adb shell bmgr backupnow <PACKAGE> I see the following error:
Running incremental backup for 1 requested packages.
Package @pm@ with result: Transport rejected package because it wasn't able to process it at the time
Backup finished with result: Transport error
In adb logcat, I see the following:
08-12 12:19:28.007 2123 2123 V Bmgr : Running backupnow for user:0
08-12 12:19:28.017 906 2524 D KeyValueBackupTask: Spinning thread key-value-backup-208
08-12 12:19:28.019 906 2147 D PFTBT : backupmanager pftbt token=211e7180
08-12 12:19:28.023 906 2147 V KeyValueBackupTask: Beginning backup of 1 targets
08-12 12:19:28.059 906 906 I TransportClient: BackupTransportService#438: Notifying [KVBT.startTask()] transport = IBackupTransport
08-12 12:19:28.062 906 2147 W Binder : Outgoing transactions from this process must be FLAG_ONEWAY
08-12 12:19:28.062 906 2147 W Binder : java.lang.Throwable
08-12 12:19:28.062 906 2147 W Binder : at android.os.BinderProxy.transact(BinderProxy.java:480)
08-12 12:19:28.062 906 2147 W Binder : at com.android.internal.backup.IBackupTransport$Stub$Proxy.name(IBackupTransport.java:869)
08-12 12:19:28.062 906 2147 W Binder : at com.android.server.backup.keyvalue.KeyValueBackupTask.startTask(KeyValueBackupTask.java:414)
08-12 12:19:28.062 906 2147 W Binder : at com.android.server.backup.keyvalue.KeyValueBackupTask.run(KeyValueBackupTask.java:344)
08-12 12:19:28.062 906 2147 W Binder : at java.lang.Thread.run(Thread.java:919)
08-12 12:19:28.065 906 2147 D KeyValueBackupTask: Starting key-value backup of @pm@
08-12 12:19:28.095 906 2147 D KeyValueBackupTask: Invoking agent on @pm@
08-12 12:19:28.095 906 5761 D BackupTransportManager: Transport com.google.android.gms/.backup.BackupTransportService updated its attributes
08-12 12:19:28.104 906 2147 V BackupAgentTimeout: getKvBackupAgentTimeoutMillis(): 30000
08-12 12:19:28.116 906 2147 I BackupRestoreController: Getting widget state for user: 0
08-12 12:19:28.157 29692 31059 I Backup : [GmsBackupTransport] Performing encrypted kv backup: @pm@
08-12 12:19:28.252 906 2147 I RecoverableAppKeyStore: Get 0/10114/com.google.android.gms.backup/folsom/<TOKEN>
08-12 12:19:28.319 497 497 W /vendor/bin/hw/android.hardware.keymaster@3.0-service: Not performing software digesting for symmetric cipher keys
08-12 12:19:28.421 497 497 I chatty : uid=9999(nobody) keymaster@3.0-s identical 2 lines
08-12 12:19:28.421 497 497 W /vendor/bin/hw/android.hardware.keymaster@3.0-service: Not performing software digesting for symmetric cipher keys
08-12 12:19:28.455 29692 29714 I gle.android.gm: Waiting for a blocking GC ProfileSaver
08-12 12:19:28.482 29692 29714 I gle.android.gm: WaitForGcToComplete blocked ProfileSaver on HeapTrim for 26.699ms
08-12 12:19:28.497 29692 29704 I gle.android.gm: WaitForGcToComplete blocked Background on ProfileSaver for 14.700ms
08-12 12:19:29.159 29692 31059 I Backup : [GmsBackupTransport] Backup finished for @pm@
08-12 12:19:29.178 906 2147 I KeyValueBackupTask: K/V backup pass finished
08-12 12:19:29.179 906 2147 D KeyValueBackupTask: Starting full backups for: [<PACKAGE>]
08-12 12:19:29.184 906 2160 I PFTBT : Initiating full-data transport backup of <PACKAGE> token: <TOKEN>
08-12 12:19:29.193 29692 31059 I Backup : [GmsBackupTransport] Attempt to do full backup on <PACKAGE>
08-12 12:19:29.294 29692 31059 I Backup : [FullBackupSession] Using encrypted processor for <PACKAGE>
08-12 12:19:29.335 906 2160 I RecoverableAppKeyStore: Get 0/10114/com.google.android.gms.backup/folsom/<TOKEN>
08-12 12:19:29.365 906 2160 I PFTBT : Transport rejected backup of <PACKAGE>, skipping
08-12 12:19:29.365 906 2160 I PFTBT : Unbinding agent in <PACKAGE>
08-12 12:19:29.366 906 2160 W ActivityManager: Unbinding backup agent with no active backup
08-12 12:19:29.366 906 2160 I PFTBT : Full backup completed with status: 0
The Transport rejected backup of <PACKAGE>, skipping error message indicates that I'm over quota, according to the Troubleshooting documentation. But my db.realm file is less than 25MB, and that's the only thing that I have set to back up in .xml, so I'm not sure why I'm getting this error.
Meanwhile, on my test device (a Pixel XL), I can go to Settings > System > Backup and confirm that "Back up to Google Drive" is switched on. Backups for other apps are working. I set a lock screen on my device, because that seemed to be one of the early issues I ran into that was preventing me from running a backup.
Any advice on how to get past this error?