Utility to extract and repack Android backups created with adb backup (ICS+).
Largely based on BackupManagerService.java from AOSP.
Building requires JDK 17+ (via the bundled Gradle wrapper). The compiled JAR targets Java 8+ bytecode (--release 8).
To create a self-executable all-in-one JAR:
./gradlew shadowJarThen run:
java -jar build/libs/abe-all.jar pack|unpack|pack-kk ...Or use the included ./abe wrapper script, which locates build/libs/abe-all.jar automatically.
./gradlew testSee Releases for pre-built runnable JAR files.
- unpack:
abe unpack <backup.ab> <backup.tar> [password] - pack:
abe pack <backup.tar> <backup.ab> [password] - pack for 4.4:
abe pack-kk <backup.tar> <backup.ab> [password](creates version 2 backups, compatible with Android 4.4.3)
If the filename is -, data is read from standard input or written to standard output.
If the password is not given on the command line, the environment variable ABE_PASSWD is tried. If no password is specified, the backup archive will not be encrypted, only compressed.
- Android is very particular about the order of files in the tar archive. The format is described here.
- Incompatible tar archives lead to errors or even system crashes.
- Apps with the
allowBackupflag set tofalseare not backed up nor restored.- (you can try restoring manually via
adb pushandadb shell)
- (you can try restoring manually via
- Errors are only printed to logcat, look out for
BackupManagerService.
The safest way to pack a tar archive is to extract the exact entry order from the original backup.tar file (excluding directory-only entries ending in /):
tar tf backup.tar | grep -F "com.package.name" | grep -v '/$' > package.listThen build the new tar archive from the extracted backup directory with --no-recursion so directories in the list are not re-walked (which would duplicate files and break ordering):
tar cf restore.tar --no-recursion -T package.listOn macOS, set COPYFILE_DISABLE=1 to avoid adding AppleDouble (._*) metadata entries, or use POSIX pax instead of BSD tar (which avoids directory entries, trailing slashes, and .DS_Store files):
pax -wd < package.list > restore.tarIf you are building a fresh archive from an extracted apps/ directory on macOS/Linux (note that each package's _manifest file must appear before its data files):
find apps -type f -not -path '*/\.*' | pax -wd > restore.tarYou can now pack restore.tar and try adb restore restore.ab.
Releases are built with GitHub Actions when a version tag (v*, e.g. v1.0.0) is pushed and include a runnable fat JAR, its SHA-256 checksum, and build provenance attestation.
Use the binaries at your own risk. No warranty or support provided.
Please report only bugs in backup extractor itself; I can't answer questions regarding unpacking/repacking backups or tar files. (See Usage for a mini usage guide.)
More details about the backup format and the tool implementation in the associated blog post.