アプリにバックアップ サポートを追加しようとしています。データ バックアップ ガイドで説明されているように、BackupAgentHelper のサブクラスを設定しました。私は自分のコードを他のいくつかのチュートリアルや SO 投稿と比較しましたが、ここでは問題は見られません。
public class MyBackupClass extends BackupAgentHelper {
public App app;
@Override
public void onCreate() {
Log.d("MyBackupClass", "** onCreate **");
// get the application delegate for convenience
this.app = (App)this.getApplicationContext();
// add the backup helpers
this.addHelpers();
}
public void addHelpers() {
Log.d("MyBackupClass", "** addHelpers **");
String name = "Sample Database";
// add a helper for the default shared preferences
String defaultSharedPrefsName = this.getPackageName() + "_preferences";
SharedPreferencesBackupHelper defaultPrefsHelper = new SharedPreferencesBackupHelper(this, defaultSharedPrefsName);
addHelper("default_prefs", defaultPrefsHelper);
// add a helper for the shared preferences
SharedPreferencesBackupHelper prefsHelper = new SharedPreferencesBackupHelper(this, name);
addHelper(name + "_prefs", prefsHelper);
// add a helper for the data file
FileBackupHelper dataHelper = new FileBackupHelper(this, name);
addHelper(name + "_data", dataHelper);
}
@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException {
// hold the lock while the FileBackupHelper performs the backup
synchronized (this.app.database.fileLock) {
Log.d("MyBackupClass", "** onBackup **");
super.onBackup(oldState, data, newState);
}
}
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// hold the lock while the FileBackupHelper restores the file
synchronized (this.app.database.fileLock) {
Log.d("MyBackupClass", "** onRestore **");
super.onRestore(data, appVersionCode, newState);
}
}
}
new BackupManager(this.app).dataChanged()
また、データを保存するたびに実行しています。
Google Play アカウントにログインし、デバイス設定でバックアップと復元のオプションが有効になっているデバイスで実行する./adb -d shell bmgr run
と、logcat で次の結果が得られます。
D/AndroidRuntime( 3828):
D/AndroidRuntime( 3828): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 3828): CheckJNI is OFF
D/dalvikvm( 3828): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 3828): Added shared lib libjavacore.so 0x0
D/dalvikvm( 3828): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 3828): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 3828): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 3828): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 3828): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 3828): failed to load memtrack module: -2
D/AndroidRuntime( 3828): Calling main entry com.android.commands.bmgr.Bmgr
V/BackupManagerService( 433): Scheduling immediate backup pass
D/AndroidRuntime( 3828): Shutting down VM
D/dalvikvm( 3828): Debugger has detached; object registry had 1 entries
V/BackupManagerService( 433): Running a backup pass
V/BackupManagerService( 433): clearing pending backups
V/PerformBackupTask( 433): Beginning backup of 2 targets
V/BackupServiceBinder( 433): doBackup() invoked
D/PerformBackupTask( 433): invokeAgentForBackup on @pm@
I/PerformBackupTask( 433): no backup data written; not calling transport
D/PerformBackupTask( 433): starting agent for backup of BackupRequest{pkg=android}
D/BackupManagerService( 433): awaiting agent for ApplicationInfo{4196f698 android}
D/BackupManagerService( 433): agentConnected pkg=android agent=android.app.backup.BackupAgent$BackupServiceBinder@4203c550
I/BackupManagerService( 433): got agent android.app.backup.BackupAgent$BackupServiceBinder@4203c550
V/BackupServiceBinder( 433): doBackup() invoked
D/BackupHelperDispatcher( 433): handling existing helper 'wallpaper' android.app.backup.WallpaperBackupHelper@4226bb08
D/PerformBackupTask( 433): invokeAgentForBackup on android
D/PerformBackupTask( 433): starting agent for backup of BackupRequest{pkg=com.arlomedia.myapp}
D/BackupManagerService( 433): awaiting agent for ApplicationInfo{41e916b0 com.arlomedia.myapp}
D/MyBackupClass ( 3779): ** onCreate **
D/MyBackupClass ( 3779): ** addHelpers **
D/BackupManagerService( 433): agentConnected pkg=com.arlomedia.myapp agent=android.os.BinderProxy@41e45118
I/BackupManagerService( 433): got agent android.app.IBackupAgent$Stub$Proxy@421a63e8
V/BackupServiceBinder( 3779): doBackup() invoked
D/MyBackupClass ( 3779): ** onBackup **
D/BackupHelperDispatcher( 3779): handling new helper 'Sample Database_data'
D/PerformBackupTask( 433): invokeAgentForBackup on com.arlomedia.myapp
D/BackupHelperDispatcher( 3779): handling new helper 'Sample Database_prefs'
D/BackupHelperDispatcher( 3779): handling new helper 'default_prefs'
I/PerformBackupTask( 433): Backup pass finished.
私が設定したヘルパーの処理に関する部分と、「バックアップ パスが終了しました」は、バックアップが機能していることを示しているようです。次に、アプリをアンインストールして再インストールすると./adb -d install
、次の結果が得られます。
D/AndroidRuntime( 3875): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 3875): CheckJNI is OFF
D/dalvikvm( 3875): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 3875): Added shared lib libjavacore.so 0x0
D/dalvikvm( 3875): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 3875): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 3875): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 3875): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 3875): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 3875): failed to load memtrack module: -2
D/AndroidRuntime( 3875): Calling main entry com.android.commands.pm.Pm
D/Finsky (23657): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 142
W/ActivityManager( 433): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
D/Finsky (23657): [1] WorkerTask.onPreExecute: Verification Requested for id = 142, data=file:///data/local/tmp/app-debug.apk flags=112 fromVerificationActivity=false
D/dalvikvm(23657): GC_CONCURRENT freed 1940K, 21% free 8146K/10228K, paused 2ms+1ms, total 34ms
D/dalvikvm(23657): GC_FOR_ALLOC freed 993K, 21% free 8130K/10228K, paused 23ms, total 24ms
D/dalvikvm(23657): GC_FOR_ALLOC freed 980K, 21% free 8136K/10228K, paused 23ms, total 23ms
D/dalvikvm(23657): GC_FOR_ALLOC freed 1051K, 20% free 8208K/10228K, paused 23ms, total 23ms
I/qtaguid (23657): Failed write_ctrl(u 74) res=-1 errno=22
I/qtaguid (23657): Untagging socket 74 failed errno=-22
W/NetworkManagementSocketTagger(23657): untagSocket(74) failed with errno -22
D/Finsky (23657): [1] 2.onResponse: Verification id=142 response=0
D/Finsky (23657): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 142
W/ActivityManager( 433): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
I/PackageManager( 433): Copying native libraries to /data/app-lib/vmdl-2084848498
D/dalvikvm( 433): GC_CONCURRENT freed 2945K, 34% free 14565K/21864K, paused 4ms+6ms, total 62ms
D/dalvikvm( 433): WAIT_FOR_CONCURRENT_GC blocked 14ms
D/dalvikvm( 433): WAIT_FOR_CONCURRENT_GC blocked 14ms
D/dalvikvm( 433): WAIT_FOR_CONCURRENT_GC blocked 46ms
I/PackageManager( 433): Running dexopt on: com.arlomedia.myapp
D/dalvikvm( 3888): DexOpt: load 64ms, verify+opt 570ms, 2417268 bytes
D/Finsky (23657): [1] 5.onFinished: Installation state replication succeeded.
I/ActivityManager( 433): Force stopping com.arlomedia.myapp appid=10140 user=-1: update pkg
V/BackupManagerService( 433): restoreAtInstall pkg=com.arlomedia.myapp token=8f restoreSet=3c51dd81eebd5a3d
D/BackupManagerService( 433): MSG_RUN_RESTORE observer=null
V/BackupServiceBinder( 433): doRestore() invoked
D/BackupManagerService( 433): initiateOneRestore packageName=@pm@
V/BackupManagerService( 433): Package com.arlomedia.myapp restore version [25] is compatible with installed version [25]
I/ActivityManager( 433): Start proc com.arlomedia.myapp for backup com.arlomedia.myapp/.helpers.Backups: pid=3889 uid=10140 gids={50140, 3003, 1028, 1015}
D/dalvikvm( 3889): Late-enabling CheckJNI
D/BackupManagerService( 433): awaiting agent for ApplicationInfo{4226acf0 com.arlomedia.myapp}
D/MyBackupClass ( 3779): ** onCreate **
D/MyBackupClass ( 3779): ** addHelpers **
D/BackupManagerService( 433): agentConnected pkg=com.arlomedia.myapp agent=android.os.BinderProxy@423dd558
I/BackupManagerService( 433): got agent android.app.IBackupAgent$Stub$Proxy@41d66818
D/BackupManagerService( 433): initiateOneRestore packageName=com.arlomedia.myapp
V/BackupServiceBinder( 3889): doRestore() invoked
D/MyBackupClass ( 3779): ** onRestore **
D/backup_data( 3889): SKIP_PADDING FAILED at line 332
V/BackupManagerService( 433): No next package, finishing restore
I/BackupManagerService( 433): Restore complete.
「復元バージョンは互換性があります」と「復元完了」の部分は有望に見えますが、データは復元されません。「SKIP_PADDING FAILED」というエラーが表示されますが、それが私が行っていることに関連しているかどうか、または関連している場合の修正方法がわかりません。
ローカルトランスポートを使用するエミュレーターでもこれを試しました。バックアップ マネージャーを実行すると、次の結果が得られます。
D/AndroidRuntime( 5503):
D/AndroidRuntime( 5503): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
W/linker ( 5503): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/AndroidRuntime( 5503): CheckJNI is ON
D/dalvikvm( 5503): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 5503): Added shared lib libjavacore.so 0x0
D/dalvikvm( 5503): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 5503): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 5503): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 5503): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 5503): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 5503): failed to load memtrack module: -2
D/AndroidRuntime( 5503): Calling main entry com.android.commands.bmgr.Bmgr
V/BackupServiceBinder( 1276): doBackup() invoked
V/BackupManagerService( 1276): Scheduling immediate backup pass
V/BackupManagerService( 1276): Running a backup pass
V/BackupManagerService( 1276): clearing pending backups
V/PerformBackupTask( 1276): Beginning backup of 2 targets
D/PerformBackupTask( 1276): invokeAgentForBackup on @pm@
I/PerformBackupTask( 1276): no backup data written; not calling transport
D/PerformBackupTask( 1276): starting agent for backup of BackupRequest{pkg=android}
D/BackupManagerService( 1276): awaiting agent for ApplicationInfo{b10042c8 android}
V/BackupServiceBinder( 1276): doBackup() invoked
D/BackupHelperDispatcher( 1276): handling existing helper 'wallpaper' android.app.backup.WallpaperBackupHelper@b12f0e70
V/LocalTransport( 1276): performBackup() pkg=android
V/LocalTransport( 1276): Got change set key=wallpaper:/data/system/wallpaper_info.xml size=-1 key64=d2FsbHBhcGVyOi9kYXRhL3N5c3RlbS93YWxscGFwZXJfaW5mby54bWw=
V/LocalTransport( 1276): Got change set key=wallpaper:/data/system/wallpaper_info.xml size=115 key64=d2FsbHBhcGVyOi9kYXRhL3N5c3RlbS93YWxscGFwZXJfaW5mby54bWw=
V/LocalTransport( 1276): data size 115
V/LocalTransport( 1276): finishBackup()
D/MyBackupClass ( 3779): ** onCreate **
D/MyBackupClass ( 3779): ** addHelpers **
V/BackupServiceBinder( 5427): doBackup() invoked
D/MyBackupClass ( 3779): ** onBackup **
D/BackupHelperDispatcher( 5427): handling new helper 'Sample Database_data'
D/BackupHelperDispatcher( 5427): handling new helper 'Sample Database_prefs'
D/BackupHelperDispatcher( 5427): handling new helper 'default_prefs'
V/LocalTransport( 1276): performBackup() pkg=com.arlomedia.myapp
V/LocalTransport( 1276): Got change set key=Sample Database_data:Sample Database size=1755 key64=U2FtcGxlIERhdGFiYXNlX2RhdGE6U2FtcGxlIERhdGFiYXNl
V/LocalTransport( 1276): data size 1755
V/LocalTransport( 1276): Got change set key=Sample Database_prefs:Sample Database size=4186 key64=U2FtcGxlIERhdGFiYXNlX3ByZWZzOlNhbXBsZSBEYXRhYmFzZQ==
V/LocalTransport( 1276): data size 4186
V/LocalTransport( 1276): Got change set key=default_prefs:com.arlomedia.myapp_preferences size=356 key64=ZGVmYXVsdF9wcmVmczpjb20uYXJsb21lZGlhLnNldGxpc3RtYWtlcl9wcmVmZXJlbmNlcw==
V/LocalTransport( 1276): data size 356
V/LocalTransport( 1276): finishBackup()
D/BackupManagerService( 1276): agentConnected pkg=android agent=android.app.backup.BackupAgent$BackupServiceBinder@b1382ba0
I/BackupManagerService( 1276): got agent android.app.backup.BackupAgent$BackupServiceBinder@b1382ba0
D/PerformBackupTask( 1276): invokeAgentForBackup on android
D/PerformBackupTask( 1276): starting agent for backup of BackupRequest{pkg=com.arlomedia.myapp}
D/BackupManagerService( 1276): awaiting agent for ApplicationInfo{b158e9a8 com.arlomedia.myapp}
D/BackupManagerService( 1276): agentConnected pkg=com.arlomedia.myapp agent=android.os.BinderProxy@b13cdbf0
I/BackupManagerService( 1276): got agent android.app.IBackupAgent$Stub$Proxy@b13ad550
D/PerformBackupTask( 1276): invokeAgentForBackup on com.arlomedia.myapp
I/PerformBackupTask( 1276): Backup pass finished.
D/AndroidRuntime( 5503): Shutting down VM
D/dalvikvm( 5503): Debugger has detached; object registry had 1 entries
I/AndroidRuntime( 5503): NOTE: attach of thread 'Binder_1' failed
再インストールすると、次の結果が得られます。
D/AndroidRuntime( 5530):
D/AndroidRuntime( 5530): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
W/linker ( 5530): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/AndroidRuntime( 5530): CheckJNI is ON
D/dalvikvm( 5530): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 5530): Added shared lib libjavacore.so 0x0
D/dalvikvm( 5530): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 5530): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 5530): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 5530): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 5530): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 5530): failed to load memtrack module: -2
D/AndroidRuntime( 5530): Calling main entry com.android.commands.pm.Pm
W/ActivityManager( 1276): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
W/ActivityManager( 1276): No content provider found for permission revoke: file:///data/local/tmp/app-debug.apk
I/PackageManager( 1276): Copying native libraries to /data/app-lib/vmdl2051152188
D/dalvikvm( 1276): GC_FOR_ALLOC freed 1352K, 21% free 7636K/9604K, paused 6ms, total 8ms
D/dalvikvm( 1276): GC_FOR_ALLOC freed 1002K, 19% free 7834K/9604K, paused 66ms, total 66ms
D/dalvikvm( 1276): GC_FOR_ALLOC freed 947K, 19% free 7840K/9604K, paused 7ms, total 7ms
D/dalvikvm( 1276): GC_FOR_ALLOC freed 946K, 19% free 7848K/9604K, paused 9ms, total 10ms
I/PackageManager( 1276): Running dexopt on: com.arlomedia.myapp
W/linker ( 5542): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/dalvikvm( 5542): DexOpt: load 15ms, verify+opt 149ms, 2414236 bytes
I/ActivityManager( 1276): Force stopping com.arlomedia.myapp appid=10067 user=-1: update pkg
W/PackageManager( 1276): Unknown permission com.android.vending.CHECK_LICENSE in package com.arlomedia.myapp
W/PackageManager( 1276): Unknown permission com.android.vending.BILLING in package com.arlomedia.myapp
V/LocalTransport( 1276): start restore 1
V/LocalTransport( 1276): nextRestorePackage() = @pm@
V/LocalTransport( 1276): getRestoreData() found 10 key files
V/LocalTransport( 1276): ... key=@meta@ size=0
V/LocalTransport( 1276): ... key=com.android.calendar size=0
V/LocalTransport( 1276): ... key=com.android.browser size=0
V/LocalTransport( 1276): ... key=com.android.providers.userdictionary size=0
V/LocalTransport( 1276): ... key=com.android.sharedstoragebackup size=0
V/LocalTransport( 1276): ... key=android size=0
V/LocalTransport( 1276): ... key=com.android.dialer size=0
V/LocalTransport( 1276): ... key=com.android.providers.settings size=0
V/LocalTransport( 1276): ... key=com.arlomedia.myapp size=635
V/LocalTransport( 1276): ... key=com.arlomedia.myotherapp size=635
V/BackupServiceBinder( 1276): doRestore() invoked
D/BackupServiceBinder( 1276): onRestore (com.android.server.PackageManagerBackupAgent) threw
D/BackupServiceBinder( 1276): java.io.EOFException
D/BackupServiceBinder( 1276): at libcore.io.Streams.readFully(Streams.java:83)
D/BackupServiceBinder( 1276): at java.io.DataInputStream.readInt(DataInputStream.java:103)
D/BackupServiceBinder( 1276): at com.android.server.PackageManagerBackupAgent.onRestore(PackageManagerBackupAgent.java:273)
D/BackupServiceBinder( 1276): at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:599)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.initiateOneRestore(BackupManagerService.java:4842)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.restorePmMetadata(BackupManagerService.java:4595)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.execute(BackupManagerService.java:4453)
D/BackupServiceBinder( 1276): at com.android.server.BackupManagerService$BackupHandler.handleMessage(BackupManagerService.java:573)
D/BackupServiceBinder( 1276): at android.os.Handler.dispatchMessage(Handler.java:102)
D/BackupServiceBinder( 1276): at android.os.Looper.loop(Looper.java:136)
D/BackupServiceBinder( 1276): at android.os.HandlerThread.run(HandlerThread.java:61)
V/LocalTransport( 1276): nextRestorePackage() = com.arlomedia.myapp
V/LocalTransport( 1276): no more packages to restore
V/LocalTransport( 1276): finishRestore()
V/BackupManagerService( 1276): restoreAtInstall pkg=com.arlomedia.myapp token=17 restoreSet=1
D/BackupManagerService( 1276): MSG_RUN_RESTORE observer=null
D/BackupManagerService( 1276): initiateOneRestore packageName=@pm@
E/BackupManagerService( 1276): Unable to call app for restore: @pm@
E/BackupManagerService( 1276): java.lang.RuntimeException: java.io.EOFException
E/BackupManagerService( 1276): at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:602)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.initiateOneRestore(BackupManagerService.java:4842)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.restorePmMetadata(BackupManagerService.java:4595)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$PerformRestoreTask.execute(BackupManagerService.java:4453)
E/BackupManagerService( 1276): at com.android.server.BackupManagerService$BackupHandler.handleMessage(BackupManagerService.java:573)
E/BackupManagerService( 1276): at android.os.Handler.dispatchMessage(Handler.java:102)
E/BackupManagerService( 1276): at android.os.Looper.loop(Looper.java:136)
E/BackupManagerService( 1276): at android.os.HandlerThread.run(HandlerThread.java:61)
E/BackupManagerService( 1276): Caused by: java.io.EOFException
E/BackupManagerService( 1276): at libcore.io.Streams.readFully(Streams.java:83)
E/BackupManagerService( 1276): at java.io.DataInputStream.readInt(DataInputStream.java:103)
E/BackupManagerService( 1276): at com.android.server.PackageManagerBackupAgent.onRestore(PackageManagerBackupAgent.java:273)
E/BackupManagerService( 1276): at android.app.backup.BackupAgent$BackupServiceBinder.doRestore(BackupAgent.java:599)
E/BackupManagerService( 1276): ... 7 more
W/BackupManagerService( 1276): Tried to clear data for @pm@ but not found
E/BackupManagerService( 1276): No restore metadata available, so not restoring settings
W/PMBA ( 1276): getRestoredMetadata() before metadata read!
E/BackupManagerService( 1276): Missing metadata for com.arlomedia.myapp
V/BackupManagerService( 1276): No next package, finishing restore
I/BackupManagerService( 1276): Restore complete.
この場合、バックアップ プロセスはバックアップされたデータのサイズを表示します。これはさらに有望ですが、復元プロセスが EOFException でクラッシュし、それを修正する方法がわかりません。繰り返しますが、何も復元されません。
最終的には、これが実際のデバイスで動作するために必要なだけですが、手がかりが得られる場合に備えて、エミュレーターからの結果を投稿しています。
これらのログを解釈して何が問題なのかを調べるのを手伝ってくれる人はいますか?
また、いくつかの SO スレッドが未回答であるか、システムが機能しないと結論付けているため、このシステムが機能するようになったかどうかについて、簡単なコメントをいただければ幸いです。
アップデート
これらのログをさらに調べたところ、デバイスまたはエミュレーターからのバックアップ中に関連するエラーはないようですが、それぞれの復元中に重大なポイントで別のエラーがスローされました。デバイスでは SKIP_PADDING FAILED、デバイスでは EOFException です。エミュレータ。SKIP_PADDING FAILED は、次の 2 つの未回答の質問に記載されています。
backup_data: 行 X で SKIP_PADDING が失敗しました
SKIP_PADDING FAILED のソースコードを読んでみましたが、何をしているのか理解できませんでした。次に、このコードを onRestore メソッドに追加して、BackupDataInput オブジェクトにデータが含まれているかどうかを確認しました。
while (data.readNextHeader()) {
String key = data.getKey();
int dataSize = data.getDataSize();
byte[] buffer = new byte[dataSize];
data.readEntityData(buffer, 0, dataSize);
Log.d("Backups", "restoring key " + key);
Log.d("Backups", "restoring data size " + dataSize);
Log.d("Backups", "restoring data " + new String(buffer, "UTF-8"));
}
します!これで、データがバックアップされていることがわかりますが、BackupAgent.performRestore (BackupAgentHelper.onRestore によって呼び出される) の何かが壊れています。onRestore メソッドでデータ ファイルを自分で保存することで、これを回避できると思います。誰かがより良い解決策を持っていますか?