2

I want to reinstall the OS on my OnePlus phone running Android 12. Before I do that I would like to backup some of my apps which don't store their data in the cloud. The phone is not rooted, so I have tried using Helium which is apparently dead, but I still tried it. While trying to enable it I found that my phone wasn't recognized by adb as a device, but this was fixed by adding the backup password, but the app just crashes when trying to backup briefly displaying this:

Helium error message

As you can see it also clicks on the "set password" option which just opens desktop. The funny thing is: I don't think I can disable the password now, so...

So after this didn't work I tried looking into backing up with ADB in PowerShell on my Windows 11 pc, but It seems to have issues with doing backups.

To list the files I just do:

adb shell pm list packages -f -3

Let's say that out of those I would like to backup this one:

package:/data/app/~~yCw1hZQNzK2LConsvhuejg==/com.rovio.BadPiggiesHD-pMe0TFd1aaE5-WduzwZ1Zw==/base.apk=com.rovio.BadPiggiesHD

It pulls the .apk file no problem with this command:

adb pull "/data/app/~~yCw1hZQNzK2LConsvhuejg==/com.rovio.BadPiggiesHD-pMe0TFd1aaE5-WduzwZ1Zw==/base.apk" ".\BP.apk"

Although, a little suspicious that it is only 58MB when it should be more like 170.

But trying to make a backup with this line:

adb backup "/data/app/~~yCw1hZQNzK2LConsvhuejg==/com.rovio.BadPiggiesHD-pMe0TFd1aaE5-WduzwZ1Zw==/base.apk=com.rovio.BadPiggiesHD"

generates an empty backup.ab file (literally 0B) even if I pass just com.rovio.BadPiggiesHD as an argument.

I have also tried using the advice from this post and adding quotes around the arguments, so ideally it I want something like this since I need both an apk and data:

adb backup "-apk com.rovio.BadPiggiesHD -f C:\Users\name\Desktop\app_backups\

But this just spits out Now unlock your device and confirm the backup operation. and stops instantly without doing anything.

I have even tried:

adb backup "-apk -shared -all -f C:\Users\name\Desktop\app_backups\full_backup.ab"

I don't need all apps, but this generates an empty file too.

What is the cause of this issue? I am at a loss since there are no error messages.

0

1 Answer 1

1

Lets get through your questions:

Using adb backup on Android 12+ devices

adb backup is mostly useless on Android devices running Android 12+, it will only work for apps that have been developed and released before Android 12.

For apps that target Android 12 (API level 31) or higher, when a user runs the adb backup command, app data is excluded from any other system data that is exported from the device.

For more details see my answer to Does adb backup/restore still work because it says it's deprecated?

Pulled APK file via adb is a bit small

Although, a little suspicious that it is only 58MB when it should be more like 170. adb pull "/data/app/~~yCw1hZQNzK2LConsvhuejg==/com.rovio.BadPiggiesHD-pMe0TFd1aaE5-WduzwZ1Zw==/base.apk" ".\BP.apk"

On recent Android devices apps are not downloaded from Google Play Store as single APK file but as bunch of split APKs. You can see that in adb shell pm path com.example.someapp as it will output multiple APK files for one app. YAouu need all of them, otherwise the app will not work.

For details how to extract split APK files from a device see the question How to get a split apk from a device via adb?

adb backup adb backup /data/app/<somepath>/base.apk does not work

The command adb backup does accept as arguments only app package names, never a path to a file on the device. Therefore this command will never work.

Backup everything (data+apps) via adb creates empty file

If you execute a command like adb backup "-apk -shared -all -f backup.ab and it does create an empty file, it could be that the backup binary bu is bugged or missing on your device.

If you execute a command like adb backup <arguments>, an adb connection will be established and on the device the command bu <arguments> will be executed. I have seen devices where the bu command was simply defect. You can test this by opening adb shell yourself and then try to execute bu --help. If this prints an error message or may be even /system/bin/sh: bu: inaccessible or not found then adb backup can not work on your device.

7
  • Thanks for the detailed response. It seems like bu is fine since It outputs the manual as it should no problem. And the app in question was released in 2012, so I doubt it was made for android 12+ :). Also, are you saying that there is basically no way to backup data on 12+ and if you need to switch to another phone or reset the current one you just lose all of your in-app data? There must be another way, right? Commented Jan 18 at 11:39
  • 1
    @user9102437 Even if the app is old it can simply deny backup in it's manifest, then adb backup will also create an empty backup. If you need to switch to a new phone you can use direct USB-to-USB connection. This is the way Google want you to transfer data to a new device.
    – Robert
    Commented Jan 18 at 11:58
  • Fair enough, but what If it is the same phone like in my case? Do I actually need a separate 256GB phone to not lose my stuff? This is ridiculous. No amount of security is worth this stupidity. Commented Jan 18 at 17:33
  • 1
    @user9102437 From Google perspective of course they prefer GDrive cloud backup. To my experience most apps deny backup (allowBackup=false in AndroidManifest.xml) so no matter which backup or migration technique you try you will loose most app data when reinstalling the phone or moving to a new one.
    – Robert
    Commented Jan 18 at 17:37
  • 1
    Holy shit, I think I figured it out. I used adb logcat > log.txt to find what was going on and found this: BackupManagerService: Backup password mismatch; aborting. So this whole time my phone was asking for a password and I just didn't see it. I was just pressing "Allow backup" and since now I have set the password, leaving the field blank no longer works... Now the file is full of data) Hopefully, it will be able to restore from this. I will check this. Commented Jan 20 at 12:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .