Saturday, June 24, 2017

storage - Is it possible to backup apk from an installed application?


I got some huge games which I don't play regularly but don't want to delete either. Is it possible to backup those apps as apk so that I can install them offline later? I'm not talking about backing up only the app data, many tools exist for that purpose. I want the ability to install the app again offline at a later time. Also, this is not necessarily an app suggestion request, any method to achieve this is OK with me.



Answer



A very easy way is ES File Explorer from Google Play Store. You can browse to your



  • /system/app folder (for system apps)

  • /data/app folder (for user apps; requires root to be accessed)



and copy them to your /sdcard (or anywhere else).


Copying multiple files with ES File Explorer is very easy. Just long hold one of the files, then put check marks on all the files you want to copy. Then browse to the folder (on your sdcard) where you want to place them.


Connecting to your computer via your usb cable will allow you to backup your sdcard content to your computer.


Update (Accessing the protected data/apps area):


I notice the /data/ directory is not readable. You can pull any of the content if you know it by name. I'll describe a (cli) solution to get the names and the files. However, the backup tools suggested by Izzy are the easiest way to go.


This is a step by step method to get the list of packages and pull the packages using the commandline:




  1. Download and Install the Android SDK package (or see Is there a minimal installation of ADB? for a solution requiring much less space, if you're not intending to develop Android apps). While you'll have access to just about everything in the world (Android), don't be too overwhimed... just focus on an immediate objective, and all the other features can be for a different day.





  2. Add a path to these two directories of the package install ([installedpath]/tools and [installedpath]/platform-tools for a full SDK installation).




  3. Now, with the Android plugged in via the usb, run this to get the full list of installed apps:
    $ adb shell 'pm list packages'
    You now have a list the names of all your install apps.





  4. Use the -f parameter to get the full pathname of a desired package by specifying a search string found in the previous list:
    $ adb shell 'pm list packages -f reader'




  5. Now pull the full pathname of the package you want to get with:


    ## adb pull [filepathname] [destination path] ##
    $ adb pull /data/app/com.ebooks.ebookreader-2.apk ~/mybackupdir


The steps might appear to be complicated, but they are easier done than said. Once you perform it a few times, you'll find it very easy to pull any app from your device. You can also write a script to do this as your own personal backup utility.



While there are gui alternatives as mentioned in the alternate answer, I strongly recommend looking at the features of the adb commands which includes full backups... the option for users to select precisely what they want backed up and where.


Installing the full Android SDK will give fuller access to components of your android device (from the commandline).


Look at the commands:


$ adb -help

Look at the backup section (of the help screen):


adb backup [-f ] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] []

- write an archive of the device's data to .
If no -f option is supplied then the data is written

to "backup.ab" in the current directory.

(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)

(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default
is noobb.)

(-shared|-noshared enable/disable backup of the device's

shared storage / SD card contents; the default is noshared.)

(-all means to back up all installed applications)

(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)

( is the list of applications to be backed up. If
the -all or -shared flags are passed, then the package
list is optional. Applications explicitly given on the

command line will be included even if -nosystem would
ordinarily cause them to be omitted.)

You can use the Android Backup Extractor to explore the compressed backup file created by the adb utility.


Restoring the backup to the android is a simple "-restore" command:


$ adb restore 

The Android Backup Extractor provides a way to explore the backup and pick out individual files (such as the apk's as in the OP's objective) to store or preserve.


The explorer package includes a variety of multi-platform tools, such as Java, perl, and cygwin.


You can extract the backup with (using the java extract opton):



## this line converts the android backup into a tar file ##
$ java -jar abe.jar unpack backup.ab backup.tar



Out side of my initial cli answer, the most precise GUI app to accomplish the OP's specific question is AirDroid. It's free, extremely user friendly and intuitive to use.


To use, run the app. It gives a local IP address for typing into a web browser. The link will give you a UI that resembles and Android home screen. Click on the "Apps" icon and select one or more apps to download. You can install or reinstall the Apps using the same interface.


There are several other GUI alternatives (graphical user interfaces) available, e.g. QtADB (multi-platform) or, for Windows users, also the excellent Droid Explorer by our member Ryan Conrad (see e.g. Full Backup of non-rooted devices; for more, also see our adb tag-wiki).


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...