Skip to main content

Extracting an Installed App's APK from Android

This guide covers two ways to get a copy of an app's APK that's been installed on your Android device, such as from Google Play Store or other app stores. This is useful for keeping backups of paid apps that might be delisted in the future, for applying unofficial mods and patches to paid apps, or for installing an app on to a device that the Play Store says is incompatible. These methods do not require root. This is guide will not help you get paid apps for free.

In these examples I will be extracting the APK of Grand Theft Auto: Liberty City Stories from an Android device.

Requirements

  • Package id of the app
  • Either one of these:
    • Option 1: Android Platform Tools and a Windows, Mac, or Linux computer.
    • Option 2: Termux from F-Droid on that device. The Google Play Store version is out of date.

Getting the app's package id

You need to find the package id of the app you want to extract. If the app was installed from Google Play Store, you can easily find it by visiting it's page on the Play Store website and checking the address. For example, the url for GTA LCS is https://play.google.com/store/apps/details?id=com.rockstargames.gtalcs&hl=en_US&gl=US. You can see that the id parameter in the url is com.rockstargames.gtalcs.

However, if the app was not installed from Play Store, you might want to install an app that will list your apps and their package ids, such as Package Name Viewer.

Option 1: Using Android Platform Tools (ADB)

There are thousands of guides on the internet that cover how to install ADB and configure your device for USB debugging. So I will not cover that myself. I recommend this guide from XDA Developers: https://www.xda-developers.com/install-adb-windows-macos-linux/

After you've setup ADB and can see your device listed with the adb devices command, you can proceed below.

If you are using Windows Powershell to run these commands, replace adb with .\adb.exe.

  1. Open a terminal window in the folder where adb is. If you successfully used adb devices to setup ADB, then you should already be there.
  2. Run this command to use the package manager to search for your app by the package id.
    adb shell pm list packages -f com.rockstargames.gtalcs
    You should get a result that might look like a bunch of junk at first, but it actually contains the path to the APK file you want to copy. Copy this path without the =(package id) at the end.
    package:/data/app/~~aWMsIewPZ36_5Zq72QRY0g==/com.rockstargames.gtalcs-h6oVCBu583ceS505JsRXYw==/base.apk=com.rockstargames.gtalcs
  3. Download the APK to your computer with ADB:
    adb pull /data/app/~~aWMsIewPZ36_5Zq72QRY0g==/com.rockstargames.gtalcs-h6oVCBu583ceS505JsRXYw==/base.apk com.rockstargames.gtalcs.apk
  4. You should now have an APK file in the same folder as your ADB files.

Option 2: Using Termux

  1. Open the Termux app on your Android device.
    Alternatively, check out my Setting up SSH on Termux guide if you'd rather run these commands from your computer rather than on the device itself.
  2. Run this command to use the package manager to search for your app by the package id.
    pm list packages -f com.rockstargames.gtalcs
    You get a result that might look like a bunch of junk at first, but it actually contains the path to the APK file you want to copy. Copy this path without the =(package id) at the end.
    package:/data/app/~~aWMsIewPZ36_5Zq72QRY0g==/com.rockstargames.gtalcs-h6oVCBu583ceS505JsRXYw==/base.apk=com.rockstargames.gtalcs
  3. Allow Termux to access your file folders.
    termux-setup-storage and select Allow on the popup.
    This will allow you to access your user folders, such as Download, from within Termux.
  4. Copy the APK file to a folder you can access, such as your Download folder.
    cp /data/app/~~aWMsIewPZ36_5Zq72QRY0g==/com.rockstargames.gtalcs-h6oVCBu583ceS505JsRXYw==/base.apk /sdcard/Download/com.rockstargames.gtalcs.apk
  5. Now that the APK file is accessible in your Files apps, you can use you preferred method to copy it to wherever you need it, such as:
    • USB connection to PC
    • Upload Google Drive or other cloud storage app
    • Download with SSH client