Extract an .APK from your Android using the CLI

Sometime we want to analyze certain app that reside in your phone (an Android one), the way to extract this .APK (via the CLI) is using this commands (first you need to connect your android via USB with developer mode activated):

adb shell pm list packages

This list all the packages names of your installed APKs

select your desire package name (in the example: com.sgt.myapp) and run:

adb shell pm path com.sgt.myapp

This command will return a path like: adb pull /data/app/com.sgt.myapp-1.apk. So with this information, run:

adb pull /data/app/com.sgt.myapp-1.apk

Now you have you APK in your computer.

 

Another useful command is:

adb shell dumpsys package com.sgt.myapp | grep versionName

that return the version name