Android offers multiple ways to transfer apps and data between phones. The usual way of transferring apps from your old device to a new one is by using the Tap & Go feature.
In addition to Tap & Go, Android also allows you to copy apps and data using ADB. If you just want to copy one specific APK, ADB can be used to grab a copy of APK or create a backup file with the APK and related data.
If you want to bring your Android skills to the next level, I highly recommend checking out some of the Udemy courses. Disclaimer: I'm participating in the Udemy Affiliate Program and I might get a small commission if you purchase something via the provided link. However, your price won’t be affected and I do believe the courses can help your career/business.
There are 2 methods that I want to show in this post.
Using the first method you only copy the APK file, but this method should work most of the time.
The second method allows to copy also app data, but the particular app has to support this.
Disclaimer: I don't support copying of paid apps or violating app licenses! Always check the license and conditions of the APK you're trying to copy to make sure you comply.
Grab APK and Install It to Another Device
This method allows you to install one specific APK file that you've grabbed from another phone. To copy the APK file do the following:
- Get APK file path from
package name
adb shell pm path eu.sisik.devowner
The pm command executed above should print something like this
package:/data/app/eu.sisik.devowner-neU2X8B9ICkjedaHEdOzkA==/base.apk
You should substitute your package name in the previous command. I used the package name from my example app from the post about device owner -
eu.sisik.devowner
.
If you're not sure how to get the package name of the app you want to copy, you can use my Power APK app for this. The main screen will display a list of installed apps and package names. You can search the app on the list by its name.
Alternatively, you can start the app you want to copy. Once it's foreground, you can get the package name with adb shell dumpsys window windows | grep "mCurrentFocus"
. I described this method in one of my posts.
Note: Sometimes the app is split into multiple APK files. This usually happens when using the Instant Run feature of Android Studio. These files are usually highly customized for the device they were deployed to and are additionally running a bit differently than apps installed from regular APKs, so the method I'm describing here won't work for this kind of APK files.
-
Pull the APK file from Android device to your PC
adb pull /path/to/apk
This will pull the APK file to current directory. You should use the path to APK obtained in the previous step
-
Install APK to target Android device
adb install -r pulled.apk
This will push the APK to the target device and execute the
pm install -r
command on the device. The-r
option means that the app should be reinstalled in case it already exists on the target device. However, app's data won't get erased with this option.
Use ADB Backup to Copy APK
This method has the advantage that you can also copy app's data together with the APK.
The disadvantage is that not all apps can be copied this way. Only apps that set the allowBackup flag to true in their AndroidManifest.xml
can be copied. Luckily, the apps that target Android 6 and higher have this value set to true by default, so even if the developer did not set this flag explicitly to true, it should still be possible to perform a backup.
To check if a particular app supports backup do the following
adb shell pm dump app.package.name | grep ALLOW_BACKUP
This gave me the following output for my DevOwner app
flags=[ DEBUGGABLE HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP ]
pkgFlags=[ DEBUGGABLE HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP ]
The flags
show that it should be possible to perform a backup for this specific app.
You should execute the following command to create a backup
adb backup -apk -f app.backup app.package.name
A dialog box asking for password and confirmation should appear on your Android device. Type in your password and tap on "BACK UP MY DATA".
This will backup the APK file and app data for your specified package into app.backup
file. In some cases this might not work reliably. Therefore you might need to add quotes to arguments or experiment with different ADB versions.
To copy the APK and data from the generated backup file to your target Android device, use the restore
command
adb restore app.backup
Copy APK with Bugjaeger
If you don't want to install ADB on your PC, you can do the same stuff as described before using the Bugjaeger app. The device that contains the original APK file should have Bugjaeger installed. To copy the app do the following
- Connect the devices with USB OTG cable and confirm the authorization dialogs (similar to what you do when you're using regular ADB)
- Switch to the Packages tab
- Tap on the add button
- Pick "Select from installed Apps" option and tap on OK
- Select the apps that you want to copy from the list and tap on INSTALL
Pulling APK Files From Android Device With Bugjaeger
In case you are only interested in getting the actual APK files from the device, you can do this simply with the Bugjaeger app.
- Switch to the Packages section
- Find the package you're interested in and click on the download icon
If you're not sure how to get the package name of the app you're interested in, check out my Power Apk which can extract various information from installed APK files. Power Apk is also able to pull the APK file from the device.
Use Backup & Restore with Bugjaeger
You can also perform ADB backup and restore with the Bugjaeger app.
To create a backup with Bugjaeger do the following
- Connect the devices with USB OTG cable and confirm the authorization dialogs (similar to what you do when you're using regular ADB)
- Switch to the Backup tab
- Tap on the backup button at the bottom right of the screen
- Type a name for your backup
- Tick the checkbox next to Include .apk files
- Select the app package from the list and tab on BACKUP
Once you've provided a password and confirmed, there should be a new entry in the Backup section of Bugjaeger. You can now restore the backup by tapping on the restore button
Note: Not all apps will allow you to create a backup. This is influenced by the allowBackup flag defined in
AndroidManifest.xml
.
Examining Android Backup Files and Extracting Their Content
Bugjaeger app allows you to examine the content of ADB backup files. Once you've successfully created a backup as described in previous section, you can tap on the created backup item in Backup section, and the app will show you the content of the backup file. You can also import ADB backups made before with ADB by tapping on the Import button