Extract Android APK with ADB

You can easily extract an Android APK file from a device using the Android Debug Bridge (ADB). This is a command line utility provided with the Android SDK that allows you to run commands on a remote device as well as transfer files to and from the device.

1. Connect your device

First connect you Android device to your computer and ensure that that USB debugging is enabled on the phone.

2. Verify the Devices

Check that the device is connected and adb can see the device with the command:

$ adb devices
List of devices attached
06157df64b014d28 device

This will display a list of the devices that are currently attached to the computer.  If there are multiple devices you the argument “-s <serial number>” in the remaining adb commands.

3.  Determine the full package name

Next you will need to determine the full package name.  This is in the URL of the application in the GooglePlay store, or you can search the list of packages to find the one that you want.

$ adb shell pm list packages | grep mobilemusings
package:org.mobilemusings.app1
package:org.mobilemusings.app2
package:org.mobilemusings.app3

4. Determine the path for the package

Then you need to get the path on the device.

$ adb shell pm path org.mobilemusings.app1
package:/data/app/org.mobilemusings.app1-2/base.apk

5. Download the APK file

You can now download the file to your computer with the adb pull command.

$ adb pull /data/app/org.mobilemusings.app1-2/base.apk <target-dir>
/data/app/org.mobilemusings.app1-2/base.apk: 1 file pulled. 24.1 MB/s (36446563 bytes in 1.442s)

Leave a Reply

Your email address will not be published. Required fields are marked *