Menu

Backups form Android 8.0

CdTC
2017-08-24
2017-09-22
  • CdTC

    CdTC - 2017-08-24

    Hello,
    is there any plan to support backups from Android 8.0? Currently it is not supported because version in these backup is 5.
    I can unpack it when I change number 5 in .ab file to 4, but it is not ideal.

    And do you know what was changed?

    Thank you,
    CdTC

     
  • dragomerlin

    dragomerlin - 2017-08-26

    Hi, I have no idea if there are real differences in the source code besides just the version number. I will try to take a look when I have some free time...

     

    Last edit: dragomerlin 2017-08-26
  • dragomerlin

    dragomerlin - 2017-08-26

    In the meantime you can edit the backup.ab with wxHexEditor and replace the 5 with a 4, it works with a couple of backups I've tested so presumably there are no important source code changes.

    Note that adb backup is partially broken on all android versions, even on newest android 8.0 Oreo, so don't completely trust them. Convert the ab file to tar and then extract it to verify there's no error, that is the only way to confirm the adb backup is valid. You can confirm that adb backup is broken installing the game Asphalt 8. Then perform a backup this way and you will see it never finishes:

    adb backup -apk -all -nosystem -shared -obb -f backup.ab

    On another console run adb logcat, you will see something like that confirming the problem:

    2512 11978 I BackupManagerService: --- Performing full backup for package com.gameloft.android.ANMP.GloftA8HM ---
    2512 11978 D BackupManagerService: awaiting agent for ApplicationInfo{507aa28 com.gameloft.android.ANMP.GloftA8HM}
    2512  3709 D BackupManagerService: agentConnected pkg=com.gameloft.android.ANMP.GloftA8HM agent=android.os.BinderProxy@367fac8
    2512 11978 I BackupManagerService: got agent android.app.IBackupAgent$Stub$Proxy@5ee761
    2512 11979 D BackupManagerService: Calling doFullBackup() on com.gameloft.android.ANMP.GloftA8HM
    2512 11978 I BackupManagerService: --- Performing full backup for package com.android.sharedstoragebackup ---
    2512 11978 D BackupManagerService: awaiting agent for ApplicationInfo{bf98058 com.android.sharedstoragebackup}
    2512  3236 D BackupManagerService: agentConnected pkg=com.android.sharedstoragebackup agent=android.os.BinderProxy@c16aa96
    2512 11978 I BackupManagerService: got agent android.app.IBackupAgent$Stub$Proxy@3a48617
    2512 11996 D BackupManagerService: Calling doFullBackup() on com.android.sharedstoragebackup
    2512  3549 D BackupManagerService: Timeout message received for token=3e014887
    2512  3549 V BackupManagerService: Cancel: token=3e014887
    

    Cancel it with Control+C, then convert the adb backup to tar and you will see the following error:

    PS C:\temp> java -jar .\abe.jar -debug unpack .\backup.ab out.tar
    Strong AES encryption allowed
    Magic: ANDROID BACKUP
    Version: 4
    Compressed: 1
    Algorithm: none
    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: java.io.EOFException: Unexpected end of ZLIB input stream
            at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:420)
            at org.nick.abe.Main.main(Main.java:128)
            ... 5 more
    Caused by: java.io.EOFException: Unexpected end of ZLIB input stream
            at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240)
            at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
            at java.io.FilterInputStream.read(FilterInputStream.java:107)
            at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:397)
            ... 6 more
    

    Google is trying to shift Android backups and restores to the cloud, so would not surprise me if the mentioned issue never gets fixed. Other bugs are present also.
    Use iOS if you want a real backup (with the exception of the apps themselves), all the data for all the apps is backed up properly.
    Android backup system is not trustworthy (never was).

     

    Last edit: dragomerlin 2017-08-26
  • dragomerlin

    dragomerlin - 2017-08-27

    Also, remember that not all applications' data will be backed up. Those that are disallowed by AndroidManifest.xml will not be saved:

    android:allowBackup = "false"
    

    Even if the backup is allowed, individual files can be excluded with the attribute "android:fullBackupContent". Users should be notified of that at the moment of performing a backup that some data will be lost forever. You think just everything will be saved but that's not the case. It's an obscure move from Google. Use iPhone and iOS to truly preserve your data.

    Read more here:
    Auto Backup for Apps

    If the jar is ever updated I will include a warning about this.

     

    Last edit: dragomerlin 2017-08-27
  • dragomerlin

    dragomerlin - 2017-08-29

    Android backup extractor 20170828 doesn't check anymore the version of the backup, so feel free too experiment with newer versions out of the box.

     
  • CdTC

    CdTC - 2017-08-29

    Thank you very much for your help!
    Yes, I have Asphalt 8 on my phone and I have encountered an error where there are 30 bytes missing in the tar file (so it is not aligned to blocks of size 512). I thought there was a problem on my side.

     
    • dragomerlin

      dragomerlin - 2017-08-29

      Use the -obb and -noshared options. Backup the sdcard copying the files to the computer directly.

       
  • Germán

    Germán - 2017-09-21

    Hi, I'm still getting an error while trying to extract a backup from a device with Android Oreo:

    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
    der.java:58)
    Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't
     know how to process version 5
            at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:444)
            at org.nick.abe.Main.main(Main.java:128)
            ... 5 more
    Caused by: java.lang.IllegalArgumentException: Don't know how to process version
     5
            at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:284)
            ... 6 more
    

    I'm using the latest version (v20170828)

     
    • dragomerlin

      dragomerlin - 2017-09-22

      New version 20170922 is out. Now it's fixed.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.