Extracting APK for an android app

Bonjour,

It does not seem trivial to get the apk file for a given application in a safe way. Ideally it would be possible to download it from play.google.com from the app page in the same way it is possible from the signal page and verify the signature.

It is however possible to:

  • Gain root access to an Android mobile with the Google Play Store installed
  • Install an app
  • Run
    $ adb shell pm list packages | grep thought
    package:org.thoughtcrime.securesms
    
  • Find the path of the desired package
    $ adb shell pm path org.thoughtcrime.securesms package:/data/app/org.thoughtcrime.securesms-x1NTSrqe00yE2tIGNJew2A==/base.apk
    package:/data/app/org.thoughtcrime.securesms-x1NTSrqe00yE2tIGNJew2A==/base.apk
    
  • Download the APK and give it a more meaningfull name
    $ adb root
    $ adb pull '/data/app/org.thoughtcrime.securesms-x1NTSrqe00yE2tIGNJew2A==/base.apk'
    /data/app/org.thoughtcrime.securesms-x1NTSrqe00yE2tIGNJew2A=...ase.apk: 1 file pulled. 23.4 MB/s (50432783 bytes in 2.051s)
    

There also is a oneliner to get all the apps:

Note, however, that some apps (such as twitter) do not work unless some Google apps are present. Since the smallest set of Google apps includes the playstore, installing such apps from an apk is futile.