BackupServiceBinder restore only 1st saved version of a file - android

I got the sample for Restore/backup by android sdk samples, and its working fine, but updating only 1st version of data. So when i install to a device, modifying some data, after all the time when i uninstall/then re will be restored only that 1 version when i installed 1st the app whit that modification.
I think data after the 1st update to the cloud will never more change.
Here is my log for :
1- installing apk
2- changing the data state.
3- uninstalling the apk
4- reinstall
5- the 1st restored that will be restoring
V/BackupManagerService(192): restoreAtInstall pkg=com.lynx.backup token=10
D/BackupManagerService(192): MSG_RUN_RESTORE observer=null
D/BackupManagerService(192): initiateOneRestore packageName=#pm#
V/BackupServiceBinder(192): doRestore() invoked
V/BackupManagerService(192): Package com.lynx.backup restore version [1] is compatible with installed version [2]
D/BackupManagerService(192): awaiting agent for ApplicationInfo{40f5f440 com.lynx.backup}
V/BackupServiceBinder(31754): doRestore() invoked
I/Backup time(31754): ..in loop..
D/BackupManagerService(192): agentConnected pkg=com.lynx.backup agent=android.os.BinderProxy#4136a118
D/BackupManagerService(192): initiateOneRestore packageName=com.lynx.backup
V/BackupManagerService(192): No next package, finishing restore
I/BackupManagerService(192): Restore complete.
D/BackupManagerService(192): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.lynx.backup flg=0x10000010 (has extras) }
V/BackupManagerService(192): addPackageParticipantsLocked: #1
V/BRActivity(31754): datafile exists
V/BRActivity(31754): mayo=true tomato=true filling=2130968577
V/PhoneStatusBar(259): setLightsOn(true)
V/BRActivity(31754): New radio item selected: 2130968579
V/BRActivity(31754): NEW STATE: mayo=true tomato=true filling=2130968579
V/BRActivity(31754): Checkbox toggled: android.widget.CheckBox#40eff6a8
V/BRActivity(31754): NEW STATE: mayo=false tomato=true filling=2130968579
D/LocalBluetoothProfileManager(32014): LocalBluetoothProfileManager construction complete
E/BinaryDictionaryGetter(352): Could not find a dictionary pack
D/BackupManagerService(192): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.lynx.backup flg=0x10000010 (has extras) }
V/BackupManagerService(192): removePackageParticipantsLocked: #1
D/LocalBluetoothProfileManager(32169): LocalBluetoothProfileManager construction complete
V/BackupManagerService(192): restoreAtInstall pkg=com.lynx.backup token=11
D/BackupManagerService(192): MSG_RUN_RESTORE observer=null
D/BackupManagerService(192): initiateOneRestore packageName=#pm#
V/BackupServiceBinder(192): doRestore() invoked
V/BackupManagerService(192): Package com.lynx.backup restore version [1] is compatible with installed version [2]
D/BackupManagerService(192): awaiting agent for ApplicationInfo{412aff08 com.lynx.backup}
D/BackupManagerService(192): agentConnected pkg=com.lynx.backup agent=android.os.BinderProxy#416c6f30
D/BackupManagerService(192): initiateOneRestore packageName=com.lynx.backup
V/BackupServiceBinder(32290): doRestore() invoked
I/Backup time(32290): ..in loop..
V/BackupManagerService(192): No next package, finishing restore
I/BackupManagerService(192): Restore complete.
D/BackupManagerService(192): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.lynx.backup flg=0x10000010 (has extras) }
V/BackupManagerService(192): addPackageParticipantsLocked: #1
V/BRActivity(32407): datafile exists
V/BRActivity(32407): mayo=true tomato=true filling=2130968577
V/PhoneStatusBar(259): setLightsOn(true)
D/BackupManagerService(192): couldn't find params for token 0

Related

What's wrong with my BackupAgentHelper implementation?

I'm trying to add backup support to my app, and have set up a subclass of BackupAgentHelper as described in the Data Backup guide. I've compared my code to several other tutorials and SO posts and don't see any problems here:
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);
}
}
}
I'm also running new BackupManager(this.app).dataChanged() whenever I save data.
On a device that's logged into a Google Play account and with the backup and restore options enabled in the device settings, I run ./adb -d shell bmgr run and get this result in the 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.
The parts about handling the helpers I set up, and the "backup pass finished" seem to indicate that the backup is working. Then, I uninstall the app and reinstall it with ./adb -d install and get the following result:
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.
The parts about "restore version is compatible" and "restore complete" look promising, but no data is restored. I see the error "SKIP_PADDING FAILED," but I don't know if that's relevant to what I'm doing or how to fix it if it is.
I also tried this with an emulator using the local transport. Running the backup manager gives this result:
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
And reinstalling gives this result:
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.
In this case, the backup process shows the size of the data backed up, which is even more promising, but then the restore process crashes with an EOFException and I don't know how to fix that. Again, nothing is restored.
Ultimately I only need this to work on real devices, but I'm posting the results from the emulator in case it provides any clues.
Can anyone help me interpret these logs to find out what's wrong?
I'd also appreciate a quick comment saying whether or not you've gotten this system to work, because several SO threads are unanswered or have concluded that the system just doesn't work.
Update
After studying these logs further, it seems there are no relevant errors while backing up from the device or the emulator, but there is a different error thrown at a critical point while restoring each of them -- SKIP_PADDING FAILED on the device and EOFException on the emulator. SKIP_PADDING FAILED is mentioned in these two unanswered questions:
backup_data: SKIP_PADDING FAILED at line X
Android Data Backup service
I tried reading the source code for SKIP_PADDING FAILED, but couldn't understand what it was doing. Next I added this code to my onRestore method to see whether the BackupDataInput object contains my data:
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"));
}
It does! So now I can see that my data is getting backed up, but something in BackupAgent.performRestore (which is called by BackupAgentHelper.onRestore) is breaking. I think I could work around that by saving the data files myself in the onRestore method. Does anyone have a better solution?
I came back to this after a week, tried again and now the backups are restoring. I haven't been able to identify anything I'm doing differently now, so I can't offer a solution to whatever problem was happening before. But now that it's working, I can clarify a few things about the Android backup service:
Contrary to other SO answers I have seen, this system does work, at least sometimes
The SKIP_PADDING FAILED error is still occurring, but isn't stopping the restore from working correctly, so that was a red herring
The backup/restore is working for me in an Android 5.0 emulator and on Android 4.4 and 4.1 devices, so it seems to have good compatibility

How to fix the error Unfortunately, the process "android.process.acore has stopped"?

we are porting whole android open source for the device Imx-6X-solo board.Developing and re-skinning all the applications.Every thing is done properly and device is ready now. But the problem is I am getting " Unfortunately, the process "android.process.acore has stopped" " error during uninstallation of the application. That is when I go to
Settings --> apps --> any third party app installed --> Uninstall .
Then I am getting this error.But app is successfully uninstalling. Can anyone please help me.. Thanks in adavance.
The logs while uninstalling are as follows..
I/ContentGridAdapter( 2576): ------- book pkg name for uninstalling is ------
com.vienom.kb.nini
D/FableSyncService( 2366): Tell package managere to uninstall: com.vienom.kb.nini
I/FableSyncManager( 2366): start processContentUninstallRequest
D/log ( 2366): ENTERED unInstallFableContent com.vienom.kb.nini
D/Log ( 2366): PACKAGE IS INSTALLED
D/log ( 2366): START FABLE UNINSTALL APP
I/FableSyncManager( 2366): exit processContentUninstallRequest
D/FableSyncService( 2366): package manager uninstalling..: com.vienom.kb.nini
W/audio_hw_primary( 1932): start_output_stream...
W/audio_hw_primary( 1932): headphone 0 ,headset 0 ,speaker 2, earpiece 0,
W/audio_hw_primary( 1932): card 0, port 0 device 2
I/PackageManager( 2059): Removing non-system package:com.vienom.kb.nini
I/ActivityManager( 2059): Force stopping package com.vienom.kb.nini uid=10034
D/dalvikvm( 2059): GC_CONCURRENT freed 360K, 11% free 7818K/8775K, paused 5ms+3ms
I/ActivityManager( 2059): Force stopping package com.vienom.kb.nini uid=10034
D/dalvikvm( 2576): GC_EXPLICIT freed 316K, 15% free 7755K/9031K, paused 2ms+2ms
D/PackageManager( 2059): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
D/PackageManager( 2059): generateServicesMap(android.content.SyncAdapter): 1 services unchanged
W/ResourceType( 2059): Failure getting entry for 0x7f060000 (t=5 e=0) in package 0 (error -75)
D/BackupManagerService( 2059): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.vienom.kb.nini flg=0x10000010 (has extras) }
V/BackupManagerService( 2059): removePackageParticipantsLocked: #1
D/dalvikvm( 2289): GC_EXPLICIT freed 358K, 8% free 5955K/6471K, paused 2ms+10ms
W/PluginManager( 2472): Can't find plugin: com.vienom.kb.nini
E/ActivityThread( 2223): Failed to find provider info for com.android.inputmethod.latin.dictionarypack
E/BinaryDictionaryGetter( 2223): Could not find a dictionary pack
W/Searchables( 2059): No global search activity found
D/VoicemailCleanupService( 2289): Cleaning up data for package: com.vienom.kb.nini
W/dalvikvm( 2289): threadid=15: thread exiting with uncaught exception (group=0x40a2b1f8)
E/AndroidRuntime( 2289): FATAL EXCEPTION: IntentService[VoicemailCleanupService]
E/AndroidRuntime( 2289): java.lang.SecurityException: The caller must have permission: com.android.voicemail.permission.ADD_VOICEMAIL
E/AndroidRuntime( 2289): at com.android.providers.contacts.VoicemailPermissions.checkCallerHasOwnVoicemailAccess(VoicemailPermissions.java:52)
E/AndroidRuntime( 2289): at com.android.providers.contacts.VoicemailContentProvider.checkPermissionsAndCreateUriData(VoicemailContentProvider.java:301)
E/AndroidRuntime( 2289): at com.android.providers.contacts.VoicemailContentProvider.delete(VoicemailContentProvider.java:129)
E/AndroidRuntime( 2289): at android.content.ContentProvider$Transport.delete(ContentProvider.java:213)
E/AndroidRuntime( 2289): at android.content.ContentResolver.delete(ContentResolver.java:822)
E/AndroidRuntime( 2289): at com.android.providers.contacts.VoicemailCleanupService.handleIntentInternal(VoicemailCleanupService.java:51)
E/AndroidRuntime( 2289): at com.android.providers.contacts.VoicemailCleanupService.onHandleIntent(VoicemailCleanupService.java:40)
E/AndroidRuntime( 2289): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
E/AndroidRuntime( 2289): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2289): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2289): at android.os.HandlerThread.run(HandlerThread.java:60)
I/ActivityManager( 2059): Start proc com.android.keychain for broadcast com.android.keychain/.KeyChainBroadcastReceiver: pid=2613 uid=1000 gids={1015, 3003, 2001, 3002, 3001}
D/dalvikvm( 2059): GC_CONCURRENT freed 635K, 13% free 7722K/8775K, paused 3ms+5ms
D/dalvikvm( 2059): GC_EXPLICIT freed 105K, 13% free 7698K/8775K, paused 5ms+5ms
D/log ( 2366): ENTERED PACKAGE UNINSTALLED OBSERVER
D/Log ( 2366): DELETE SUCCEEDEDcom.vienom.kb.nini
I/ActivityManager( 2059): Start proc com.android.defcontainer for service com.android.defcontainer/.DefaultContainerService: pid=2627 uid=10005 gids={1015, 2001}
I/FableDatabase( 2366): deleteContentName: 9001Status 0
I/FableDatabase( 2366):
I/FableDatabase( 2366): Thumbnail not found for :com.vienom.kb.nini
I/FableDatabase( 2366): Deleted from device: /mnt/sdcard/fable/books/22_fable_full.apk
D/MediaProvider( 2211): object removed 50
I got the solution. By mistake I removed the Contacts app. Every time, Contacts Storage app is checking for contacts.So Now again I installed Contacts.apk. And it works fine after installing.
one more solution is
Settings --> apps --> All --> Contacts Storage --> clear data and Force stop
Backup your contacts. Go to settings and clear the "Data" of Contact Storage. This will remove all your contacts. After that, restore your contacts back and the error will go. This basically happens when FB messes up with your contacts.
it is not directly contacts related. 10 minutes ago this message start to popup every 1 second (!). It started to popup after i removed my account from DROPBOX. I tried rebooting several times but nothing helped.
Finally i decided to re-link the account i removed from DROPBOX and then the popup message stopped !
The problem appears because there is a broken link. To some it appears with contacts. To me it happend with DROPBOX. I assume to others it can happend with a different app.
It is an Android failure, not an app faluire.
(I use Galaxy S4 with Kitkat 4.4.2)
Good Luck,
Yuval
My repair has not been posted as of yet - here is another.
Settings->applications manager->bottom left menu button / Choose reset app preferences / Choose Reset Apps.
This worked for me ,,, Must have shut something off that android/Samsung didn't like
cheers

Android Toast cannot be resolved as field or type

I've done some research on the above error and it would seem that to solve there are two ways most people do:
Re import R
Close and restart eclipse
However I have done both and yet I still get the same error. Does anyone know of any other ways to defeat this error?
I'm thinking though that it may be my code. I'm trying to compile the bluetooth le sample found here
I've brought over everything yet I'm still stuck with 36 errors with most of them being this cannot be resolved as field or type error.
Here is how they call the toast line:
Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
And there strings.xml found in the values folder:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BLE Sample</string>
<string name="ble_not_supported">BLE is not supported</string>
<string name="label_data">Data:</string>
<string name="label_device_address">Device address:</string>
<string name="label_state">State:</string>
<string name="no_data">No data</string>
<string name="connected">Connected</string>
<string name="disconnected">Disconnected</string>
<string name="title_devices">BLE Device Scan</string>
<string name="error_bluetooth_not_supported">Bluetooth not supported.</string>
<string name="unknown_device">Unknown device</string>
<string name="unknown_characteristic">Unknown characteristic</string>
<string name="unknown_service">Unknown service</string>
<!-- Menu items -->
<string name="menu_connect">Connect</string>
<string name="menu_disconnect">Disconnect</string>
<string name="menu_scan">Scan</string>
<string name="menu_stop">Stop</string>
</resources>
I'm literally a day into my first android development and this is all new to me. I thought using the sample code they would provide would help me get a good over view of how the bluetooth system works.
Can anyone help me beat this error?
I should add that every item on this list has an error. Any time I call anything with R.string. it get the same error.
Logcat since 1:25pm:
09-06 13:25:20.901: E/(526): W/virtual loc_api_adapter_err LocApiAdapter::enableData(int): default implementation invoked
09-06 13:25:20.901: E/(526): W/virtual loc_api_adapter_err LocApiAdapter::setAPN(char*, int): default implementation invoked
09-06 13:25:20.911: D/PicasaUploaderSyncManager(25851): active network: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: "SOL2", roaming: false, failover: false, isAvailable: true
09-06 13:25:20.921: D/GCM(2565): GcmService start Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x8000010 cmp=com.google.android.gms/.gcm.GcmService (has extras) } android.net.conn.CONNECTIVITY_CHANGE
09-06 13:25:21.051: D/ConnectivityService(526): handleInetConditionHoldEnd: net=1, condition=100, published condition=0
09-06 13:25:21.542: D/Tethering(526): MasterInitialState.processMessage what=3
09-06 13:25:21.642: E/(526): W/virtual loc_api_adapter_err LocApiAdapter::enableData(int): default implementation invoked
09-06 13:25:21.642: E/(526): W/virtual loc_api_adapter_err LocApiAdapter::setAPN(char*, int): default implementation invoked
09-06 13:25:21.662: D/GCM(2565): GcmService start Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x8000010 cmp=com.google.android.gms/.gcm.GcmService (has extras) } android.net.conn.CONNECTIVITY_CHANGE
09-06 13:25:22.102: D/ConnectivityService(526): handleInetConditionHoldEnd: net=1, condition=100, published condition=100
09-06 13:30:01.245: V/DigitalWidgetViewsFactory(6453): DigitalWidget sets next alarm string to null
09-06 13:36:19.083: I/ActivityManager(526): No longer want com.google.android.talk (pid 26303): empty for 1801s
09-06 13:36:31.455: V/BackupManagerService(526): Running a backup pass
09-06 13:36:31.455: V/BackupManagerService(526): clearing pending backups
09-06 13:36:31.455: V/PerformBackupTask(526): Beginning backup of 1 targets
09-06 13:36:31.485: V/BackupServiceBinder(526): doBackup() invoked
09-06 13:36:31.485: D/PerformBackupTask(526): invokeAgentForBackup on #pm#
09-06 13:36:31.495: I/PerformBackupTask(526): no backup data written; not calling transport
09-06 13:36:31.506: D/PerformBackupTask(526): starting agent for backup of BackupRequest{pkg=com.android.providers.settings}
09-06 13:36:31.506: D/BackupManagerService(526): awaiting agent for ApplicationInfo{4202bfe0 com.android.providers.settings}
09-06 13:36:31.506: D/BackupManagerService(526): agentConnected pkg=com.android.providers.settings agent=android.app.backup.BackupAgent$BackupServiceBinder#42081138
09-06 13:36:31.506: I/BackupManagerService(526): got agent android.app.backup.BackupAgent$BackupServiceBinder#42081138
09-06 13:36:31.506: D/PerformBackupTask(526): invokeAgentForBackup on com.android.providers.settings
09-06 13:36:31.516: V/BackupServiceBinder(526): doBackup() invoked
09-06 13:36:31.526: W/SettingsBackupAgent(526): Couldn't backup /data/misc/wifi/ipconfig.txt
09-06 13:36:31.526: I/PerformBackupTask(526): no backup data written; not calling transport
09-06 13:36:31.526: I/PerformBackupTask(526): Backup pass finished.
09-06 13:39:59.999: I/ActivityManager(526): No longer want com.google.android.music:main (pid 26385): empty for 1849s
09-06 13:40:00.099: W/ActivityManager(526): Scheduling restart of crashed service com.google.android.music/.playback.MusicPlaybackService in 5000ms
09-06 13:40:05.134: I/ActivityManager(526): Start proc com.google.android.music:main for service com.google.android.music/.playback.MusicPlaybackService: pid=27303 uid=10041 gids={50041, 3003, 1015, 1028}
09-06 13:40:05.214: I/MusicStore(27303): Database version: 70
09-06 13:40:05.274: D/dalvikvm(27303): GC_CONCURRENT freed 315K, 4% free 9097K/9448K, paused 3ms+9ms, total 39ms
09-06 13:40:05.274: D/dalvikvm(27303): WAIT_FOR_CONCURRENT_GC blocked 2ms
09-06 13:40:05.284: D/dalvikvm(27303): WAIT_FOR_CONCURRENT_GC blocked 5ms
09-06 13:40:05.364: D/SystemUtils(27303): getSystemProperty: lpa.decode=null
09-06 13:40:05.364: D/CacheService(27303): onCreate
09-06 13:40:05.374: D/CacheService(27303): onBind
09-06 13:40:05.384: I/LocalDevicePlayback(27303): Streaming client created.
09-06 13:40:06.445: D/dalvikvm(27303): GC_CONCURRENT freed 181K, 3% free 9337K/9580K, paused 4ms+4ms, total 30ms
09-06 13:40:06.535: I/MediaStoreImporter(27303): Update: incremental Added music: 0 Updated music: 0 Deleted music: 0 Created playlists: 0 Updated playlists: 0 Deleted playlists: 0 Inserted playlist items: 0 Deleted playlist items: 0 Removed orphaned playlist items: 0
09-06 13:40:10.459: I/MusicLeanback(27303): Conditions not met for autocaching.
09-06 13:40:10.459: I/MusicLeanback(27303): Stop autocaching.
09-06 13:40:20.549: D/GCM(2565): Ignoring attempt to send heartbeat on dead connection.
09-06 13:40:59.997: I/ActivityManager(526): No longer want android.process.acore (pid 26550): empty for 1807s
09-06 13:45:01.283: V/DigitalWidgetViewsFactory(6453): DigitalWidget sets next alarm string to null
09-06 13:48:16.403: I/EventLogService(2565): Aggregate from 1378470317827 (log), 1378469896229 (data)
09-06 13:48:16.533: I/ServiceDumpSys(2565): dumping service [account]
09-06 13:50:23.497: I/jdwp(24586): Ignoring second debugger -- accepting and dropping
09-06 13:50:23.507: I/jdwp(20948): Ignoring second debugger -- accepting and dropping
09-06 13:50:34.378: D/dalvikvm(526): GC_CONCURRENT freed 3407K, 27% free 23292K/31488K, paused 11ms+8ms, total 146ms
09-06 13:52:43.224: D/ChildProcessLauncher(5790): Setting up connection to process: slot=2
09-06 13:52:43.224: I/ActivityManager(526): Start proc com.android.chrome:sandboxed_process2 for service com.android.chrome/org.chromium.content.app.SandboxedProcessService2: pid=27469 uid=99002 gids={}
09-06 13:52:43.244: I/ChildProcessService(27469): Creating new ChildProcessService pid=27469
09-06 13:52:43.254: D/ChildProcessLauncher(5790): on connect callback, pid=27469 context=2105709408
09-06 13:52:43.254: I/LibraryLoader(27469): loading: chromeview
09-06 13:52:43.304: I/LibraryLoader(27469): loaded: chromeview
09-06 13:52:43.304: I/chromium(27469): [INFO:library_loader_hooks.cc(72)] Chromium logging enabled: level = 0, default verbosity = 0
09-06 13:52:43.314: D/TraceEvent(27469): View tag enabled: false
09-06 13:52:43.334: I/chromium(27469): [INFO:child_process_service.cc(132)] ChildProcessService: Exiting child process.
09-06 13:52:43.344: W/ChildProcessConnection(5790): onServiceDisconnected (crash?): pid=27469
09-06 13:52:43.344: D/ChildProcessLauncher(5790): stopping child connection: pid=27469
09-06 13:52:43.344: I/ActivityManager(526): Process com.android.chrome:sandboxed_process2 (pid 27469) has died.
09-06 13:52:43.344: W/ActivityManager(526): Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.SandboxedProcessService2 in 5000ms
Try to show Toast like this:
Toast.makeText(context, context.getString(R.string.error_bluetooth_not_supported),Toast.LENGTH_LONG).show();
Here context refers to context of current Activity where you showing the Toast.
See these as well: Toast.makeText from resource string
Android: Java: using a string resource in a Toast
1) Typically, all R.string.stuff cease to be errors after you build the project because the file R.java is generated during the build. If you have not yet built the project, they are shown as errors and this is normal. By the way, in Eclipse, you can manually delete the error messages in the error message window (you can select and delete one or several errors, but cannot delete the root node that reads "Errors (N items)"). One more "magic" pass is pressing F5 ("Refresh") when the project is selected in the "Package Explorer" (the left-hand) pane.
2) Make sure that the generated R class belongs to the same package as the class where it's used. In Eclipse you must see in the "Package Explorer" pane: YourProject--gen--your.package--R.java.
(If that file does not exist, is the folder read/write?)
3) It may be easier to create an empty project and move the google sources to it than try to compile the project from git. At least some google app projects use a directory structure that is different from what you normally get with Eclipse (because they are built with a special script).
Generally when there are any errors in the resource folder , the R.Java file doesnt get created properly and as a result you will get this sort of error . Please check whether you have any errors in the layout folder or drawable folder.
Use:
Toast.makeText(this, getResources().getText(R.string.error_bluetooth_not_supported).toString(), Toast.LENGTH_SHORT).show();
U can use:
String str = getResources().getText(R.string.error_bluetooth_not_supported).toString();

Android Mono '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found

I wonder if you can help me with this error.
I am running a fresh fully updated install of windows 7 with
Visual studio 2010 Professional in trial mode.
In Visual Studio I create a new OpenGl Mono for Android Application
using the built in template.
I compile and run the application.
The emulator boots (I am running API_8) EMU.
The application starts and then aborts.
(In the emulator I get a black screen which quickly closes.)
Same thing happens if I do similar using the Mono Develop IDE
and or the other templates.
Here is a dump of the error message (I cannot find much info on google)
It looks like the error is related to the load library fail.
Thanks
// DUMP
03-05 23:23:47.464 D/AndroidRuntime( 418):
03-05 23:23:47.464 D/AndroidRuntime( 418): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-05 23:23:47.464 D/AndroidRuntime( 418): CheckJNI is ON
03-05 23:23:47.574 D/AndroidRuntime( 418): --- registering native functions ---
03-05 23:23:48.034 I/ActivityManager( 60): Start proc OpenGLApplication1.OpenGLApplication1 for broadcast OpenGLApplication1.OpenGLApplication1/mono.android.Seppuku: pid=424 uid=10038 gids={3003, 1015}
03-05 23:23:48.164 I/ActivityThread( 424): Publishing provider OpenGLApplication1.OpenGLApplication1.__mono_init__: mono.MonoRuntimeProvider
03-05 23:23:48.174 D/dalvikvm( 424): Trying to load lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:48.174 D/dalvikvm( 424): Added shared lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:48.184 F/MonoDroid( 424): shared runtime initialization error: Cannot load library: load_library[1083]: Library '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found
03-05 23:23:48.204 I/ActivityManager( 60): Process OpenGLApplication1.OpenGLApplication1 (pid 424) has died.
03-05 23:23:48.214 D/AndroidRuntime( 418): Shutting down VM
03-05 23:23:48.214 D/jdwp ( 418): adbd disconnected
03-05 23:23:48.624 D/AndroidRuntime( 432):
03-05 23:23:48.624 D/AndroidRuntime( 432): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-05 23:23:48.624 D/AndroidRuntime( 432): CheckJNI is ON
03-05 23:23:48.734 D/AndroidRuntime( 432): --- registering native functions ---
03-05 23:23:49.173 I/ActivityManager( 60): Start proc OpenGLApplication1.OpenGLApplication1 for broadcast OpenGLApplication1.OpenGLApplication1/mono.android.Seppuku: pid=438 uid=10038 gids={3003, 1015}
03-05 23:23:49.294 I/ActivityThread( 438): Publishing provider OpenGLApplication1.OpenGLApplication1.__mono_init__: mono.MonoRuntimeProvider
03-05 23:23:49.303 D/dalvikvm( 438): Trying to load lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:49.303 D/dalvikvm( 438): Added shared lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7f010
03-05 23:23:49.314 F/MonoDroid( 438): shared runtime initialization error: Cannot load library: load_library[1083]: Library '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found
03-05 23:23:49.334 I/ActivityManager( 60): Process OpenGLApplication1.OpenGLApplication1 (pid 438) has died.
03-05 23:23:49.344 D/AndroidRuntime( 432): Shutting down VM
03-05 23:23:49.344 D/jdwp ( 432): adbd disconnected
03-05 23:23:50.333 D/AndroidRuntime( 447):
03-05 23:23:50.333 D/AndroidRuntime( 447): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
03-05 23:23:50.333 D/AndroidRuntime( 447): CheckJNI is ON
03-05 23:23:50.443 D/AndroidRuntime( 447): --- registering native functions ---
03-05 23:23:50.873 I/ActivityManager( 60): Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=OpenGLApplication1.OpenGLApplication1/openglapplication1.Activity1 }
03-05 23:23:50.893 I/ActivityManager( 60): Start proc OpenGLApplication1.OpenGLApplication1 for activity OpenGLApplication1.OpenGLApplication1/openglapplication1.Activity1: pid=453 uid=10038 gids={3003, 1015}
03-05 23:23:50.923 D/AndroidRuntime( 447): Shutting down VM
03-05 23:23:50.923 D/jdwp ( 447): adbd disconnected
03-05 23:23:50.953 I/AndroidRuntime( 447): NOTE: attach of thread 'Binder Thread #3' failed
03-05 23:23:51.173 I/ActivityThread( 453): Publishing provider OpenGLApplication1.OpenGLApplication1.__mono_init__: mono.MonoRuntimeProvider
03-05 23:23:51.223 D/dalvikvm( 453): Trying to load lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7eef0
03-05 23:23:51.223 D/dalvikvm( 453): Added shared lib /data/data/OpenGLApplication1.OpenGLApplication1/lib/libmonodroid.so 0x44e7eef0
03-05 23:23:51.263 F/MonoDroid( 453): shared runtime initialization error: Cannot load library: load_library[1083]: Library '/data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so' not found
03-05 23:23:51.283 I/ActivityManager( 60): Process OpenGLApplication1.OpenGLApplication1 (pid 453) has died.
03-05 23:23:51.293 I/UsageStats( 60): Unexpected resume of com.android.launcher while already resumed in OpenGLApplication1.OpenGLApplication1
03-05 23:23:51.423 W/InputManagerService( 60): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#45104b68
The issue is from the newer versions of mono where libmonosgen-2.0 does not get installed automatically. The path that you will see in which it fails is actually a simlink for the library. What you have to do is manually or through a non-mono apk, create the following:
A folder with your package name in /data/app-lib/
in the folder you will have to push the libmonosgen-2.0.so (and libmonodroid.so if needed)
After this is done you have to navigate to data/data/your.package.name and create a simlink from lib -> the folder you created previously. the command to use is ln -s.
I have noticed that in some cases the simlink exists, but is pointing to a false location.
I had to do this manually and it would not survive a factory reset. A colleugue of mine actually did this the non-mono apk path which does everything for him when ever the provisioning app executes on first launch.
Try going to the project properties and turn off "fast deployment". Then manually remove your app from the emu/device, and try again.
Another possibility is that you don't have enough free space on your device. The problem isn't in your package (OpenGLApplication1), the problem is from installing the Mono.Android.DebugRuntime package, as /data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so doesn't exist.
I would suggest looking through the adb logcat log, and see if something like the following is present:
W/NativeHelper( 98): Failed to cache package shared libs
W/NativeHelper( 98): java.io.IOException: Couldn't create cached binary /data/data/Mono.Android.DebugRuntime/lib/libmonosgen-2.0.so in /data/data/Mono.Android.DebugRuntime/lib
W/NativeHelper( 98): at com.android.internal.content.NativeLibraryHelper.copyNativeBinaryLI(NativeLibraryHelper.java:289)
If messages like the above are present, remove the Mono.Android.DebugRuntime package (adb uninstall Mono.Android.DebugRuntime), remove some extra apps from your device (to free up space), and try re-installing your app from the IDE.

onRestore not invoked for my custom BackupAgent

There are some data in my Android app that I would like to backup and restore. For that purpose I have created a custom implementation of BackupAgent.
In my manifest in have included the backup agent as you can see below
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
package="com.myapp"
android:versionCode="14"
android:versionName="1.13" >
<application
android:backupAgent="com.myapp.MyBackupAgent">
<meta-data
android:name="com.google.android.backup.api_key"
android:value="my key" />
I have included the backup service api key, although I am testing with the emulator (Android 2.2) and it should not be necessary, because it uses the local backup transport.
In order to do the test of the backup and restore I have done the following:
Start the emulator with my application installed.
Enable backup
adb shell bmgr enable true
Call the part of my code were the dataChanged method in the BackupManager class is called.
Initiate manually the backup operation
adb shell bmgr run
Checked in the log that the onBackup method of my custom BackupAgent was called.
Uninstall the app
Reinstall the app
Check in the log if the onRestore method is called.
The thing is that the onRestore method does not seem to be called and I don't know why. After reinstalling the app or manually triggering the restore with adb I see the following in the console.
$adb shell bmgr restore com.myapp
restoreStarting: 2 packages
restoreFinished: 0
done
and this other in the log
D/AndroidRuntime( 8259):
D/AndroidRuntime( 8259): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 8259): CheckJNI is ON
D/AndroidRuntime( 8259): --- registering native functions ---
D/BackupManagerService( 59): MSG_RUN_RESTORE observer=android.app.backup.IRestoreObserver$Stub$Proxy#450e16a8
V/LocalTransport( 59): start restore 1
V/LocalTransport( 59): nextRestorePackage() = #pm#
V/LocalTransport( 59): getRestoreData() found 7 key files
V/LocalTransport( 59): ... key=com.android.providers.settings size=1208
V/LocalTransport( 59): ... key=com.myapp size=501
V/LocalTransport( 59): ... key=android size=1208
V/LocalTransport( 59): ... key=com.android.providers.userdictionary size=1208
V/LocalTransport( 59): ... key=com.android.browser size=1208
V/LocalTransport( 59): ... key=com.android.inputmethod.latin size=1208
V/LocalTransport( 59): ... key=#meta# size=11
V/LocalTransport( 59): no more packages to restore
V/LocalTransport( 59): finishRestore()
V/LocalTransport( 59): finishRestore()
D/AndroidRuntime( 8259): Shutting down VM
but I don't see that the call to onRestore is actually made (I have some logging statements just at the beginning of it?
Has this ever happen to you? Is there any reason by the onRestore method is not called, even in the onBackup was called?
In my experience, for some odd reason (which I have yet to identify), logging statements made in BackupAgents don't show up in the logs. Nonetheless, I have been able to confirm that the onRestore method is in fact properly run.
In your question you indicate that the onRestore method "does not seem to be called" because you are unable to see the proper logs. Can you instead confirm that the result is failing (i.e. that data that should be properly restored isn't)?
I had this problem and the root cause was that I had a bug in my onBackup preventing it from completing, so onBackup was called but onRestore was not. Fixing the exception in onBackup caused onRestore to be called.
Also Log messages in onBackup and onRestore do show up in the logs. If you set a log filter on the tag "backup" and use something with backup in it for your log tag. You will see logging from the system and yours. Here is what I get
09-08 17:06:56.581 294-352/system_process V/BackupServiceBinder﹕ doBackup() invoked
09-08 17:06:56.591 294-352/system_process D/PerformBackupTask﹕ starting agent for backup of BackupRequest{pkg=android}
09-08 17:06:56.591 294-352/system_process D/BackupManagerService﹕ awaiting agent for ApplicationInfo{40d5efc0 android}
09-08 17:06:56.591 294-308/system_process D/BackupManagerService﹕ agentConnected pkg=android agent=android.app.backup.BackupAgent$BackupServiceBinder#4112a228
09-08 17:06:56.601 294-352/system_process V/BackupServiceBinder﹕ doBackup() invoked
09-08 17:06:56.601 294-352/system_process D/BackupHelperDispatcher﹕ handling existing helper 'wallpaper' android.app.backup.WallpaperBackupHelper#41149150
09-08 17:06:56.621 294-352/system_process D/PerformBackupTask﹕ starting agent for backup of BackupRequest{pkg=com.catglo.sellpr}
09-08 17:06:56.661 294-352/system_process D/BackupManagerService﹕ awaiting agent for ApplicationInfo{41074748 com.catglo.sellpr}
09-08 17:06:56.781 294-514/system_process D/BackupManagerService﹕ agentConnected pkg=com.catglo.sellpr agent=android.os.BinderProxy#410768c8
09-08 17:06:56.791 2263-2274/com.catglo.sellpr V/BackupServiceBinder﹕ doBackup() invoked
09-08 17:06:56.791 2263-2274/com.catglo.sellpr I/backup﹕ onBackup called
09-08 17:06:57.251 294-352/system_process I/PerformBackupTask﹕ Backup pass finished.
in the above log com.catglo.sellpr is from my app and the line that reads com.catglo.sellpr I/backup﹕ onBackup called is the log message in my code. For the onRestore I get
09-08 17:13:34.431 294-352/system_process D/BackupManagerService﹕ MSG_RUN_RESTORE observer=android.app.backup.IRestoreObserver$Stub$Proxy#413132c0
09-08 17:13:34.511 294-352/system_process V/BackupServiceBinder﹕ doRestore() invoked
09-08 17:13:34.561 294-352/system_process D/BackupManagerService﹕ awaiting agent for ApplicationInfo{41074748 com.catglo.sellpr}
09-08 17:13:34.561 294-427/system_process D/BackupManagerService﹕ agentConnected pkg=com.catglo.sellpr agent=android.os.BinderProxy#41127ee0
09-08 17:13:34.571 2263-2276/com.catglo.sellpr V/BackupServiceBinder﹕ doRestore() invoked
09-08 17:13:34.571 2263-2276/com.catglo.sellpr I/backup﹕ onRestore called
Earlier I had an exception in onBackup and my log from onRestore was never called but the system messages related to restore were.
The app will not Force Close because of an exception in the backup.

Categories

Resources