1 minute read

How to download .apk file from Play Store

The best mobile automation content delivered straight to your inbox.

Introduction

There are three ways to download Android apps from Google Play Store for your attention:

  • Using third party websites (easiest, but not the safest way)
  • Using device on Android (the most secure and exact way)
  • Using google-play-cli (automation friendly way)
Preview

To download *.apks* following this method you have to know app's bundle identifier.

Using third party websites

As I said, this is not the provenest and the safest method, so use it at your own risk (:

Using device on Android

  1. At first you need to install app from Play Store to your phone

  2. Secondly you should enable «Unknown sources» in your phone’s security settings (Settings => Security => Unknown sources)

  3. Then connect your phone to your PC using a USB cable/WiFi (adb needs to see it)

  4. Make sure you have installed adb

  5. Download an .apk:

bundleId="<your_bundle>"
apk=`adb shell pm path $bundleId`
apk=`echo $apk | awk '{print $NF}' FS=':' | tr -d '\r\n'`
adb pull $apk app.apk

Using Google-Play-CLI

The best way to make this process automated.

  1. Install google-play-cli:

     brew install node
     npm i google-play-cli -g
    
  2. Set environment variables in your bash.profile:

    • GOOGLE_LOGIN - email address used on a mobile phone.
    • GOOGLE_PASSWORD - The password used to access the Play Service.
    • ANDROID_ID - the device GSF ID for Google. You can get the gsf id e.g., using the device id app.
     touch .bash_profile
     open .bash_profile
     export GOOGLE_LOGIN=[email protected]
     export GOOGLE_PASSWORD=password
     export ANDROID_ID=a3n3d3r3o3i3d3i3d
     source .bash_profile
    
  3. Download an .apk:

     gp-download "<your_bundle>" > app.apk
    

Conclusion

Downloading apps from Google Play Store can be a fairly simple process, either manual or automated.

Also you can find an answer how to download an .ipa from Apple App Store here.

The best mobile automation content delivered straight to your inbox.

Updated: