Hello,
first of all thank you for your work, i've getting this error if i run abe:
$ java -jar abe.jar info backup_20140503.ab passwd
Strong AES encryption enabled
Magic: ANDROID BACKUP
Version: 1
Compressed: 1
Algorithm: AES-256
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:183)
at org.nick.abe.Main.main(Main.java:40)
... 5 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313)
at javax.crypto.Cipher.doFinal(Cipher.java:2087)
at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:110)
... 6 more
Could we do anything with this?
thanks,
hadesz
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
also have the same problem using latest available version
java -jar abe.jar unpack D:\Program\android\rockbar3.jpg D:\Program\android\rockbar3b.jpg password
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(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:231)
at org.nick.abe.Main.main(Main.java:40)
... 5 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:129)
... 6 more
also tried with abe-master.jar and it's the same,
info show
Strong AES encryption allowed
Magic: ANDROID BACKUP
Version: 1
Compressed: 0
Algorithm: AES-256
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Without having physical access to files or devices, I can't help you more.
You can try making the adb backup again and save the logcat to a file. Don't post the file here because may contain passwords.
"adb logcat" while you make the backup.
Last edit: dragomerlin 2017-07-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The backup seems to work fine. I have also repeated the backup run many times. However, trying to create a tar-archive from the resulting .ab-file with the command
java -jar /usr/local/bin/abe.jar info filename.ab filename.ab.tar password
I keep getting the error message below. Every involved component (adb and abe.jar) are at the latest revision. I wonder what I am missing...
@hstoellinger I'm pretty sure that's the android bug which hasn't been fixed yet. Probably the backup was generated incorrecly on the android phone. To get further information, we can check the log:
Provided that you have the phone connected to the computer, open a terminal and type this to clear the current log:
adb logcat -c
On the same terminal, generate and save a filtered logcat:
When it finishes, hit Control+C on the first terminal to close the pipe
Check that the logxperia.txt has no private information and post it here or attached. I'm almost 100% sure that it will have some error which causes the backup to be corrupted.
Last edit: dragomerlin 2017-12-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Use always the -noshared option. To backup the sdcard, you can do "adb pull /sdcard/" but it's very very slow, better copy the contents to some OTG usb or external sdcard if you have it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You've got 2 errors (see the capital E in the log). Don't buy again from Sony, they have defective software. If you just want to backup, I think Sony has its own application for that or Settings option.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi again,
I did another backup after uninstalling the two offending apps ---- same result! Enclosed are two logcat outputs - logxperia.txt (adb backup --shared ...) and logxperia3.txt (adb backup --noshared...). Might there be any data left on the phone, even AFTER uninstalling?
Regards
H.S.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The output of logcat is enclosed -- no errors...
Running
java -jar /usr/local/bin/abe.jar info /mnt/hwe/backups/xperia/adb/system/2017-12-16.ab ~/tmp/.ab.tar pw...
still gives the same result. Could this be a bug in adb-backup? One thing: I have to enter a password at the start of the backup process (phone encrypted). Could this be an issue?
Thanks again for your patience...
Try the official adb from Android Studio. My current Windows version is:
adb -version
Android Debug Bridge version 1.0.36
Revision 1:7.0.0+r33-1
Yes if your phone is encrypted you are forced to use the SAME password for the backup process. Are you using the same password?
Try making a backup of a simple program to see if it works. For example, you can use my script "No ADB backup app lister" and try to backup one of those apps that do allow adb backup (not all packages are allowed to be backed up due to google policies). Example:
IMPORTANT UPDATE: don't use further arguments than "-apk" because apparently doesn't work. Use "-apk" or nothing. If I put more arguments tries to backup the whole device. Not sure if this is a bug or the intended behaviour.
tar tf speedtest.tar > /dev/null
echo $?
tar tf speedtest_apk.tar > /dev/null
echo $?
In my case, my LG V20 forces me to set a password, because the option "BACKUP MY DATA" is greyed out unless some password is set.
Also, on the same phone I can use a different password to encrypt the backup. It does not have to be the same pin code that is used to unlock the phone (that one which is required if you have fingerprint unlock for example). So, apparently, you are allowed to use a different password to encrypt the backup from the one used to actually encrypt the device.
Last edit: dragomerlin 2017-12-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello dragomerlin, I'm having some trouble extracting an adb backup.
This is the backup command "adb backup -noapk com.imangi.templerun2 -f backup.ab" with the latest 8.1 Android platform tools on a completely stock LG G5 H850 with Android 7.0.
Also using latest v20171005 abe tool in cygwin on Windows 10 laptop.
This is the command I run for extraction: "java -jar abe.jar unpack backup.ab backup.tar",
and this is the error I get:
"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(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: incorrect data check
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.util.zip.ZipException: incorrect data check
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:469)
... 6 more"
and of course the output tar archive is corrupted.
This is what info gets returns:
"Strong AES encryption not allowed
Magic: ANDROID BACKUP
Version: 4
Compressed: 1
Algorithm: none"
The backup.ab is a very big file, around 320 MB, can this be an issue ?
Do you have any suggestion for me ? What can I try ?
I want to backup some games because I'm changing devices and I'm stuck.
Thank you so much !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@anpa24 that is an issue with Cygwin, run the commands from Windows Powershell.
Note that some games, Temple Run 2 included, use Google Saved Games, so you don't need to make a backup on purpose, provided that you are loged in with Google Play Games. Just install Temple Run 2 on the new device and your progress will be restored. Check that it works before deleting the old device. You can see a cloud icon on the Android Play Store:
If you are moving to iOS that doesn't work. Some games like Angry Birds use its own servers to sync game progress or other games like Candy Crush can link progress with you Facebook account.
Last edit: dragomerlin 2018-01-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
transforming to .tar I get invalid block error messages
d:\adbbackup\extract>java -jar abe.jar unpack phorgnzr.ab backup
Backup encrypted, enter password (will NOT be displayed):
Password:
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(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: invalid block type
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.util.zip.ZipException: invalid block type
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:469)
... 6 more
any suggestion?
thanks for the work you did ^_^
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
first of all thank you for your work, i've getting this error if i run abe:
$ java -jar abe.jar info backup_20140503.ab passwd
Strong AES encryption enabled
Magic: ANDROID BACKUP
Version: 1
Compressed: 1
Algorithm: AES-256
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:183)
at org.nick.abe.Main.main(Main.java:40)
... 5 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313)
at javax.crypto.Cipher.doFinal(Cipher.java:2087)
at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:110)
... 6 more
Could we do anything with this?
thanks,
hadesz
Was the backup with password created with Kitkat? Because if so, the abe.jar need to be updated.
If you can manage with source code you can test directly from developer the latest version compatible with kitkat:
https://github.com/nelenkov/android-backup-extractor
I'll update the abe.jar as soon as I can.
Last edit: dragomerlin 2014-05-10
FIXED. New version is out with support for encrypted backups on android 4.4.
Have the same problem for lollipop, don't know whether update is needed,
thanks.
Lollipop is a very recent release and is known to have some bugs. The original developer may add support for it.
Last edit: dragomerlin 2014-11-16
Check now if works.
also have the same problem using latest available version
java -jar abe.jar unpack D:\Program\android\rockbar3.jpg D:\Program\android\rockbar3b.jpg password
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(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:231)
at org.nick.abe.Main.main(Main.java:40)
... 5 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:129)
... 6 more
also tried with abe-master.jar and it's the same,
info show
Strong AES encryption allowed
Magic: ANDROID BACKUP
Version: 1
Compressed: 0
Algorithm: AES-256
Probably you have a defective backup file. I'm supposing the rockbar3.jpg is an ab file. Check here because this users have the same error:
https://github.com/nelenkov/android-backup-extractor/issues/33
https://github.com/nelenkov/android-backup-extractor/issues/46
https://stackoverflow.com/questions/8049872/given-final-block-not-properly-padded
Without having physical access to files or devices, I can't help you more.
You can try making the adb backup again and save the logcat to a file. Don't post the file here because may contain passwords.
"adb logcat" while you make the backup.
Last edit: dragomerlin 2017-07-15
Hello,
I am trying to backup my Sony Xperia XA1 (Android 7.0) phone under Linux KDE-Neon 5.8.8 using the following command:
The backup seems to work fine. I have also repeated the backup run many times. However, trying to create a tar-archive from the resulting .ab-file with the command
I keep getting the error message below. Every involved component (adb and abe.jar) are at the latest revision. I wonder what I am missing...
@hstoellinger I'm pretty sure that's the android bug which hasn't been fixed yet. Probably the backup was generated incorrecly on the android phone. To get further information, we can check the log:
When it finishes, hit Control+C on the first terminal to close the pipe
Check that the logxperia.txt has no private information and post it here or attached. I'm almost 100% sure that it will have some error which causes the backup to be corrupted.
Last edit: dragomerlin 2017-12-08
Use always the -noshared option. To backup the sdcard, you can do "adb pull /sdcard/" but it's very very slow, better copy the contents to some OTG usb or external sdcard if you have it.
Hello,
Thanks for bothering to help! Please find enclosed the result of the procedure you suggest.
Greetings from Salzburg/Austria
You've got 2 errors (see the capital E in the log). Don't buy again from Sony, they have defective software. If you just want to backup, I think Sony has its own application for that or Settings option.
Thanks for the hint! I have uninstalled the two offending apps. Will try a backup tomorrow and see what happens.
Hi again,
I did another backup after uninstalling the two offending apps ---- same result! Enclosed are two logcat outputs - logxperia.txt (adb backup --shared ...) and logxperia3.txt (adb backup --noshared...). Might there be any data left on the phone, even AFTER uninstalling?
Regards
H.S.
There shouldn't be any data left regarding adb. Anyway I can't see the logs.
Attachments are missing in my last message...
You shouldn't have those packages installed. Do the following command:
adb shell 'pm list packages -f'
Hello once again,
I have now backed up the phone (Sony-Experia-XA1, Android 7.0) with the command
The output of logcat is enclosed -- no errors...
Running
still gives the same result. Could this be a bug in adb-backup? One thing: I have to enter a password at the start of the backup process (phone encrypted). Could this be an issue?
Thanks again for your patience...
Last edit: Heinrich Stoellinger 2017-12-16
Try the official adb from Android Studio. My current Windows version is:
Yes if your phone is encrypted you are forced to use the SAME password for the backup process. Are you using the same password?
Try making a backup of a simple program to see if it works. For example, you can use my script "No ADB backup app lister" and try to backup one of those apps that do allow adb backup (not all packages are allowed to be backed up due to google policies). Example:
In this case the backup must be small and have only the intended app. If it makes a complete backup it's wrong.
Make the logcat with:
Last edit: dragomerlin 2017-12-16
IMPORTANT UPDATE: don't use further arguments than "-apk" because apparently doesn't work. Use "-apk" or nothing. If I put more arguments tries to backup the whole device. Not sure if this is a bug or the intended behaviour.
That way it should backup ONLY that app. To record the logcat use (on another terminal):
Then extract the tar from the encrypted .ab files. The echo command should show 0 which means the process went fine:
Now, check the integrity of the file:
In my case, my LG V20 forces me to set a password, because the option "BACKUP MY DATA" is greyed out unless some password is set.
Also, on the same phone I can use a different password to encrypt the backup. It does not have to be the same pin code that is used to unlock the phone (that one which is required if you have fingerprint unlock for example). So, apparently, you are allowed to use a different password to encrypt the backup from the one used to actually encrypt the device.
Last edit: dragomerlin 2017-12-16
Hello dragomerlin, I'm having some trouble extracting an adb backup.
This is the backup command "adb backup -noapk com.imangi.templerun2 -f backup.ab" with the latest 8.1 Android platform tools on a completely stock LG G5 H850 with Android 7.0.
Also using latest v20171005 abe tool in cygwin on Windows 10 laptop.
This is the command I run for extraction: "java -jar abe.jar unpack backup.ab backup.tar",
and this is the error I get:
"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(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: incorrect data check
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.util.zip.ZipException: incorrect data check
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:469)
... 6 more"
and of course the output tar archive is corrupted.
This is what info gets returns:
"Strong AES encryption not allowed
Magic: ANDROID BACKUP
Version: 4
Compressed: 1
Algorithm: none"
The backup.ab is a very big file, around 320 MB, can this be an issue ?
Do you have any suggestion for me ? What can I try ?
I want to backup some games because I'm changing devices and I'm stuck.
Thank you so much !
@anpa24 that is an issue with Cygwin, run the commands from Windows Powershell.
Note that some games, Temple Run 2 included, use Google Saved Games, so you don't need to make a backup on purpose, provided that you are loged in with Google Play Games. Just install Temple Run 2 on the new device and your progress will be restored. Check that it works before deleting the old device. You can see a cloud icon on the Android Play Store:
If you are moving to iOS that doesn't work. Some games like Angry Birds use its own servers to sync game progress or other games like Candy Crush can link progress with you Facebook account.
Last edit: dragomerlin 2018-01-03
i made a backup of an app o mine (very big file more than 1GB of data)
d:\adbbackup\extract>adb backup -noapk com.lightelements.photoeventplanner -f d:\adbbackup\phorgnzr
(Nexus 9 - Android 7.1.1 build N4F26T security level march 2017)
transforming to .tar I get invalid block error messages
d:\adbbackup\extract>java -jar abe.jar unpack phorgnzr.ab backup
Backup encrypted, enter password (will NOT be displayed):
Password:
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(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: invalid block type
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.util.zip.ZipException: invalid block type
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:469)
... 6 more
any suggestion?
thanks for the work you did ^_^
Probably it's an android bug, there are more than you think. We can try to get the error from the device itself:
Open a terminal and do (don't close process):
Open another terminal an do the adb backup there:
When the backup is finished close the process with Control+C and open the log.txt
Last edit: dragomerlin 2018-01-05