Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Retrieve APK from Non-Rooted Android Device through ADB

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

  2. Get the full path name of the APK file for the desired package.

    adb shell pm path com.example.someapp

    The output will look something like this: package:/data/app/com.example.someapp-2.apk

  3. Pull the APK file from the Android device to the development box.

    adb pull /data/app/com.example.someapp-2.apk

Copy link

AlainMuller commented Jun 7, 2018

Thank you for the info, you can merge the 2 first commands in one using the -f option (which displays associated file) :
adb shell pm list packages -f | grep someapp
-> package:/data/app/com.example.someapp-2/base.apk=com.example.someapp

BTW, a useful trick to quickly find the associated package is to launch the app and find the displayed activity using this command :
adb shell dumpsys activity top | grep ACTIVITY
-> ACTIVITY com.example.someapp/.app.HomeActivity 2dbf6e2 pid=18453

Copy link

kwhat commented Jul 29, 2019

adb pull from the /data directory does not work on modern devices. There is no way around this besides having root.

Copy link

andrew-koster- commented Oct 5, 2019

My phone is like a year old and not rooted. adb pull worked fine.

Copy link

ctrl-freak commented Oct 16, 2019

I've been doing this successfully regularly on a Samsung A8 and Moto Z3 Play, both on Android 8.0

Copy link

sschilz commented Oct 18, 2019

To extract an app installed from the play store on a Galaxy Tab A Running Android 9
I used the following command from a git bash shell:

$ adb shell "pm list packages -f" | grep video

which returned this data:

and this command successfully retrieved it:
adb pull /data/app/ 1 file pulled. 27.9 MB/s (5924177 bytes in 0.202s)

This Android Package Browser was useful because it showed the actual name of the APK was formatted as:
folders+ base name + guid({g6xTrW...})+ "==/base.apk"

meaning the actual filename to be pulled is apparently:

Copy link

MarkWalters-pw commented Dec 4, 2019

Only partially works on my unrooted android pie. Looks like the permissions on the external sdcard are more strict than the internal. Adoptable storage isn't a good idea without root. Note to self: Next time select "format as portable storage" not "format as internal".

# Only pulls the first apk if multiple matches.  Remove head and use a for loop if you want all.
echo 'apkls() { adb shell pm list packages -f|grep $1;}' >> ~/.bashrc
echo 'apkpull() { adb pull `apkls $1|head -n1|sed "s/package://"|sed "s/\.apk=/.apk /"`.apk;}' >> ~/.bashrc
. ~/.bashrc
mark@p72:/tmp$ apkpull bromite
adb: error: failed to stat remote object '/mnt/expand/7a55b1cc-1941-4bd8-9d92-acab17089911/app/org.bromite.bromite--TapI3VrZImW9gnZXd6MrQ==/base.apk': Permission denied
mark@p72:/tmp$ apkpull termux
/data/app/com.termux-MwJfUSG9B6cWiTp0ai3pkQ==/base.apk: 1 file pulled. 22.1 MB/s (66136654 bytes in 2.848s)

Copy link

delrocco commented Feb 20, 2020

Still worked tonight on a Google Pixel 2 with Android 10 / API 29. Developer options and USB debugging enabled.

I needed the .apk from a project we published 3 years ago, and I didn't have the old codebase re-building yet in modern Android Studio. So I just downloaded it from Google Play and pulled it with adb.

Copy link

bugfinder123 commented Jul 24, 2020

adb shell pm path com.example.someapp and adb pull /data/app/com.example.someapp-2.apk working for me thanks

Copy link

Noah-It-All commented Feb 4, 2021

Great! It worked on an unrooted samsung J7

Note they dont make that phone anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment