Skip to content

Latest commit

 

History

History
463 lines (209 loc) · 270 KB

Android Backup and Restore Guide.md

File metadata and controls

463 lines (209 loc) · 270 KB

This file was auto-generated using word-to-markdown. Check out the pdf/docx file for better reading experience.


Android Backup and Restore guide for Non-Rooted Devices

By Evyatar Ben-Shitrit

https://github.com/eviabs/Android-Backup-and-Restore-Guide

In this guide we will also show how to backup/restore the Grindr app, and fix the "unable to refresh" error.

We will also use Grindr as an example across the guide.

Getting Started with adb

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device

https://developer.android.com/studio/command-line/adb.html

Installing and using adb:

_ Getting adb working on your machine._

  1. 1)Get adb ( https://developer.android.com/studio/command-line/adb.html).
  2. 2)Enable debugging mode on your phone ( http://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm).
  3. 3)Install Google USB Driver if you don't got them ( https://developer.android.com/studio/run/win-usb.html)
  4. 4)Open cmd and navigate to the adb file location.
  5. 5)Run: adb devices_and make sure that your device is listed:_

a.A successful command will look like this: check the pdf for images or like this: check the pdf for images 2. b.If no devices are listed, and you are getting this message: check the pdf for images run: adb kill-server and then again adb devices. 3. If still no devices are listed, try one of the following solutions: 1. https://stackoverflow.com/questions/21170392/android-device-does-not-show-up-in-adb-list 2. https://stackoverflow.com/questions/41792867/adb-device-list-is-empty?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa 6. 6)Now adb should be working.

Backup

An *.ab backup contains all your personal and hidden data of your app. It doesn't necessary contain your local storage data (which located in your sd card). Make sure you copy by yourself the sd card content as well.

Backup using adb:

Creating an *.ab backup file using adb.

Single app backup:

  1. 1)Follow the adb guide.
  2. 2)Go to adb location and run_adb devices_. Make sure that the device list has your phone.
  3. 3)Run the following command: adb backup -f myAndroidBackup.ab com.grindrapp.android
  4. myAndroidBackup.ab is your backup name.
  5. com.grindrapp.android is your app's package name. The name can be viewed by: https://play.google.com/store/apps/details?id=com.csdroid.pkg
  6. 4)A backup file named myAndroidBackup.ab is now created on your current folder.
  7. 5)If backup is empty or smaller than 2 kbs, try an older version of adb. One is located under the adb fastboot files folder ( https://android.stackexchange.com/a/123818/216569)

Full backup (all apps):

Same as above, just use the following command:adb backup -apk -shared -all -f fullAndroidBackup.ab

References:

https://forum.xda-developers.com/showthread.php?t=2011811

http://nelenkov.blogspot.ca/2012/06/unpacking-android-backups.html

http://stackoverflow.com/questions/15558353/how-can-one-pull-the-private-data-of-ones-own-android-app

Backup using Helium:

Creating an *.ab backup file using Helium app. Note: it looks like Helium cannot backup properly if you use titanium's profiles with the app you want to backup. So, if you do use titanium's profiles, just use titanium to backup/restore/extract data to a new Helium backup.

  1. 1)Follow the adb guide.

  2. 2)Install Helium on your phone ( https://play.google.com/store/apps/details?id=com.koushikdutta.backup&hl=en)

  3. 3)Install Helium on your Chrome browser ( https://chrome.google.com/webstore/detail/helium-backup/gpglbgbpeobllokpmeagpoagjbfknanl)

  4. 4)Connect your phone to your computer.

  5. 5)Go to adb location and run_adb devices_. Make sure that the device list has your phone.

  6. 6)Launch Helium app on your phone and press ok: check the pdf for images

  7. 7)Open Helium extension on chrome: check the pdf for images

  8. 8)Now press ok on your phone: check the pdf for images

  9. 9)Choose Grindr, check App Data Only and press BACKUP. check the pdf for images

  10. 10)Choose Internal Storage and wait (do not touch anything, the app will do this for you): check the pdf for images

  11. 11)When finished, the following dialog will appear (click OK and exit Helium): check the pdf for images

  12. 12)Now your *.ab backup file is in your phone: Phone\ carbon\com.grindrapp.android.

  13. 13)If you get this error, there are a few solutions: check the pdf for images "Backup Error - An error occured when performing your app backup. A log of the error has been sent to ClockworkMod"

check this out: https://forums.androidcentral.com/ask-question/406201-helium-backup-app-error.html#post5752258

  1. Clear Helium cache, clear Helium data, uninstall Helium, restart phone, reinstall Helium and try again.
  2. Plug/unplug trick.
  3. Backup as shown in Backup using adb section, and then try again using Helium.

Restore

Restore using adb:

Single app backup:

  1. 1)Follow the adb guide.
  2. 2)Go to adb location and run_adb devices_. Make sure that the device list has your phone.
  3. 3)Make sure the app is installed on your phone! Adb will not install it for you.
  4. 4)Run the following command: adb restore myAndroidBackup.ab
  5. myAndroidBackup.ab is your backup name.
  6. 5)App is now restored.

Restore using Helium:

Follow the Backup using Helium guide, and just use the restore function 😊

Convert *.ab backup file to tar file and vice verca

In order to view a backup's content or modify it, we must convert it to an archive. If we wish to restore our backed-up or modified data, we need to pack it as an *.ab file

helium_ab2tar method:

_ Convert Helium_ *.ab backup to tar and vice versa. Reference: https://forum.xda-developers.com/showpost.php?p=75862940&postcount=7

You can compile the code by yourself, but I have already done this for you. Check the compiled files folder under helium_ab2tar folder. All exe files are there. If you fail to run them, you'll have to compile them by your own using this post:

Hi, the "helium_ab2tar" ( https://github.com/floe/helium_ab2tar) finally helped me. Good work!

I was running Win7 and didn't have any C compiler installed, so here is what I found:

  1. 1)from the link above, extract helium_ab2tar-master.zip to a new directory
  2. 2)from http://gnuwin32.sourceforge.net/packages/make.htm download Binaries and Dependencies and extract files make.exe, libintl3.dll, libiconv2.dll to your helium_ab2tar-master directory
  3. 3)from https://bellard.org/tcc/ download a recent TinyCC build and extract the whole zip into your helium_ab2tar-master directory
  4. 4)edit the makefile and change "CC=gcc" to "CC=tcc\tcc.exe"
  5. 5)change "-o ab2tar_cut" to "-o ab2tar_cut.exe", "-o ab2tar_corr" to "-o ab2tar_corr.exe", "-o tar2ab_cut" to "-o tar2ab_cut.exe", "-o tar2ab_corr" to "-o tar2ab_corr.exe"
  6. 6)finally run make.exe

How to use:

ab2tar_cut [.ab file] [temporary file] ab2tar_corr [temporary file] [.tar file]

Or:

tar2ab_cut [.tar file] [temporary file] tar2ab_corr [temporary file] [.ab file]

android-backup-tookit methods:

_ Convert adb or Helium_ *.ab backup to tar. The files are located under android-backup-tookit folder. Reference: https://forum.xda-developers.com/showpost.php?p=75862940&postcount=7

Adb backup to tar using abe:

  1. 1)Make sure you have got the needed software detailed in the reference.
  2. 2)Run the following command: java -jar abe.jar unpack myAndroidBackup.ab myAndroidBackup.tar <password>
  3. myAndroidBackup.ab is your backup name.
  4. myAndroidBackup.tar is your tar that will be created.
  5. password is your backup password. Leave blank is no password set.
  6. 3)A new tar file is now created, which contains your data.

Adb backup to tar using dd (works on linux):

  1. 1)Make sure you have got the needed software detailed in the reference.
  2. 2)Run the following command: dd if=myAndroidBackup.ab bs=1 skip=24|openssl zlib -d > myAndroidBackup.tar
  3. myAndroidBackup.ab is your backup name.
  4. myAndroidBackup.tar is your tar that will be created.
  5. 3)A new tar file is now created, which contains your data.

Healium backup to tar:

  1. 1)Make sure you have got the needed software detailed in the reference.
  2. 2)Run the following command: java -jar hbe.jar -force/-tar com.unicell.pangoandroid
  3. -force/-tar means that either -force or -tar arguments should work. Try both.
  4. com.grindrapp.android is your app's package name.
  5. 3)A new tar is now created, which contains your data.

Tar to ab:

  1. 1)Make sure you have got the needed software detailed in the reference.
  2. 2)Run the following command if you got android lower than 4.4.3: java -jar abe.jar pack myAndroidBackup.tar myAndroidBackup.ab <password>
  3. myAndroidBackup.ab is your backup name.
  4. myAndroidBackup.tar is your tar that will be created.
  5. password is your backup password. Leave blank is no password set.
  6. 3)Or the following command if got higher than 4.4.3: java -jar abe.jar pack 4.4.3+ pack-kk myAndroidBackup.tar myAndroidBackup.ab <password>
  7. myAndroidBackup.ab is your backup name.
  8. myAndroidBackup.tar is your tar that will be created.
  9. password is your backup password. Leave blank is no password set.
  10. 4)A new *.ab file is now created, which contains your data and ready to be restored.

Fix Grindr's "unable to refresh" error

If you don't need any of your previous data (messages, images, etc.), just uninstall the app and reinstall it. If you do want to keep your data follow this guide.

Basically, we will backup your current Grindr profile and will extract the databases out of it. Then, we will insert the databases into a new and working Grindr installation.

Fix unable to refresh error with root and Titanium Backup:

It is recommended to backup your app using Titanium Backup before tying this. We assume that you are using Titanium Backup's Data Profiles. If you don't, enable "multiple profiles" for Grindr app and create 2 profiles named default and empty_._ default profile will be attached to your main Grindr account. empty profile is an empty newly created profile.

Method 1 (fastest, but might not work):

  1. 1)Switch to default profile
  2. 2)With root explorer navigate to: /data/data/com.grindrapp.android/shared_prefs

3)Delete the folder's content except the following 2 files: check the pdf for images 4. 4)Open Grindr 5. 5)Log in to your profile (if asked) 6. 6)Profit 😊

Method 2:

  1. 1)Switch to empty profile.
  2. 2)Clear the Grindr's cache of the empty profile using titanium
  3. 3)Open Grindr and log in to your account (same account used with default profile, you may change password if forgotten)
  4. 4)Switch to default profile
  5. 5)With root explorer navigate to: /data/data/com.grindrapp.android/.data_profiles/empty
  6. 6)Copy all folders except: databases, cache (optional).
  7. 7)With root explorer navigate to: /data/data/com.grindrapp.android/
  8. 8)Paste the folders (override, do not merge them)
  9. 9)Switch to empty profile
  10. 10)Clear the Grindr's cache of the empty profile using titanium (so you will not be logged in with 2 profiles)
  11. 11)Switch to default profile
  12. 12)Open Grindr
  13. 13)Profit 😊

Note: The folder databases contains all of your messages and images. Since Grindr's folder structure is changed every now and then, you may need to copy and paste less/more files each time.

Fix unable to refresh error without root :

If no root is available, use this method. Note that a root will guarantee a successful backup and restore, but, unfortunately, the non-root method will not.

  1. 1)Create a folder named "grindr" on your Desktop: C:\Users\User\Desktop\grindr (replace "User" with your windows user name).
  2. 2)Backup the target Grindr app (the app that contains your precious data, probably located on your old phone):
  3. Create an *.ab backup file using Helium or adb backup (see relevant sections).
  4. Copy the created *.ab file to your grindr folder.
  5. Make sure that size of the *.ab is big enough (bigger than 72kb). If the size is smaller, try both Helium and adb backup methods. If both methods creates small files, the method WILL NOT work and a root is needed ☹
  6. Name this *.ab file old.ab.
  7. 3)Clear Grindr's cache and data ( https://www.androidcentral.com/how-and-when-clear-app-cache-or-data-android)
  8. 4)Open Grindr, log in to your account and close the app.
    1. Repeat stage 2, and name the *.ab file new.ab.

6)Convert both old.ab and new.ab to tar files. Use the appropriate extractor found in android-backup-tookit or helium_ab2tar (depends on your backup type - adb or Helium). A tar should look like this: check the pdf for images 7. 7)Copy db folder from the old backup and paste it (override) the db folder in the new backup. Note: maybe more/less data should be copied! It's a trial and error game. 8. 8)Compress (to a tar) the new modified backup and repack it to a new *.ab. 9. 9)Restore the newly modified *.ab file.