I'm migrating app data involving several packages, using adb backup and restore, from an older phone (source) to a newer phone (target). Android versions are detailed below. I'm using the following procedure for each one of them:

1. Generate a backup file on source phone:

a) Alternative: with apk

C:\>adb devices
C:\>adb backup -f com.example.package.ab -apk com.example.package

b) Alternative: without apk

C:\>adb backup -f com.example.package.ab com.example.package

2. Restore backup file on target phone:

a) Alternative: with apk

C:\>adb devices
C:\>adb restore com.example.package.ab

b) Alternative: without apk (installing clean app first)

C:\>adb restore com.example.package.ab

Note: The package name listed is obfuscated as com.example.package.

Android version are: 4.4.4 on source phone and 8.1.0 on target phone.

After following these steps for each package, I get no app(s) present on my target phone, with no error messages at all (just a "finished"-like toast notification is shown). However, I managed to dump some error messages regarding app restore process via adb logcat on the target phone that might be interesting and/or helpful. They follow:

a) Alternative: with apk

C:\>adb logcat

03-31 19:14:58.478  2050 26649 I BackupManagerService: Package com.example.package not installed; requiring apk in dataset
03-31 19:14:58.478  2050 26649 D BackupManagerService: Installing from backup: com.example.package
03-31 19:15:01.528 26665 26678 W asset   : Asset path /data/cache/backup_stage/com.example.package is neither a directory nor file (type=0).
03-31 19:15:01.529 26665 26678 W DefContainer: Failed to parse package at /data/cache/backup_stage/com.example.package: android.content.pm.PackageParser$PackageParserException: Failed to parse /data/cache/backup_stage/com.example.package

b) Alternative: without apk

C:\>adb logcat

03-31 20:08:45.154  2050 30170 D BackupManagerService: Need to launch agent for com.example.package
03-31 20:08:45.155  2050 30170 I ActivityManager: Force stopping com.example.package appid=10155 user=0: clear data
03-31 20:08:45.157  2050  2096 I ActivityManager: Force stopping com.example.package appid=10155 user=-1: clearApplicationUserData
03-31 20:08:45.160  2050 30170 I ConditionProviders: Disallowing condition provider com.example.package
03-31 20:08:45.283  2723  2723 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_ALL packageName=com.example.package]
03-31 20:08:45.300  2050 30170 I ActivityManager: Start proc 30204:com.example.package/u0a155 for backup android/FullBackupAgent
03-31 20:08:45.300  2050 30170 D BackupManagerService: awaiting agent for ApplicationInfo{455f3d3 com.example.package}
03-31 20:08:45.352  2050 11378 D BackupManagerService: agentConnected pkg=com.example.package agent=android.os.BinderProxy@c07c18e
03-31 20:08:45.607  3020  7675 I Icing   : doRemovePackageData com.example.package
03-31 20:08:51.277  2050 30170 D BackupManagerService: Invoking agent to restore file code_cache/secondary-dexes/com.example.package-2.apk.classes2.dex
03-31 20:08:51.426  2050 30170 D BackupManagerService: Invoking agent to restore file code_cache/secondary-dexes/com.example.package-2.apk.classes2.zip
03-31 20:08:52.024  2050  5655 I ActivityManager: Process com.example.package (pid 30204) has died: cch+4CEM

I want to mention some additional considerations about my phone configuration which might be causing some trouble:

  • Both my older and newer phone are not rooted and I don't want them to be.
  • I'm not sure if I'm using the right "ADB Interface" controller on my Windows desktop (under Device Manager).
  • My target phone is encrypted.
  • Is it necessary to have "unknown sources" enabled to make adb restore to work? (I can't remember I needed it on other backup/restore operations regarding different phones than the mentioned ones on this question. Of course, Developer Options are enabled on both phones.)
  • I'm not sure if I'm using a version of adb Windows executable that is compatible with my target phone Android version.

So, after reminding that I previously used this procedure between other combinations of source/target Android versions (for example: from ICS to KitKat) and it worked right, my question is: Is there any way to get this backup procedure work between the mentioned versions of Android (source/target)? If the answer is "no"; why? and: do other methods not involving adb backup and restore exist to achieve the same goal: Google Drive, third party apps, manufacturer specific apps, etc...? (Note: Absolutely I'd rather use adb backup/restore whenever it's possible.)

Related or similar questions I've found follow:
Applications are not installed with adb restore
adb backup on Marshmallow - is it different?

Final note: Sorry if I used some bad translated user interface messages or strings, since I don't use English language on either my Android devices or Windows desktop.

  • 2
    I do remember a backup file format change especially regarding the encryption. May be it helps to unpack and then repack the backup data using adb backup extractor
    – Robert
    Apr 3 '20 at 17:27
  • 1
    Try first installing the .apk itself, and restore the backup afterwards. That's a known bug with Android 7 IIRC which might still be open with some Android 8 devices. The tools folder of my Adebar gives you the needed helpers for Linux/Mac and Cygwin: you'd want abrestore for your purpose (it extracts the .apk from the backup, installs it, and then restores the backup). Let me know if that did the job, so I can write up an answer.
    – Izzy
    Apr 3 '20 at 22:05
  • and of course, not mentioned already, test backup & restore single app from/to same target phone 8.1 is working in general. latest adb xda-developers.com/…
    – alecxs
    Apr 4 '20 at 10:39
  • I achieved restoring a single package this way: using ADB 1.0.31 to create the backup from Android 4.4.4 and using ADB 1.0.41 (got from here) to restore it to Android 8.1.0. Both are Windows executables. I need to do a little more testing before ensure it works for every package. Should I post a self-answer after doing that?
    – Pestro
    Apr 10 '20 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.