8

Is it possible to install an app from Play Store using the command line and if yes, how?

What I am trying to accomplish is something similar to using adb install file.apk but instead of an apk file the target would be a package name of a Play Store app (for e.g. adb install com.spotify.mobile.android.ui).

Is something like this possible?

4

Short Answer : No.

Long Answer :

adb install is a "shortcut" that is equivalent to open a shell (using adb shell) and type pm install. pmstand for package-manager and his behaviour is the same as other package manager in other Linux distributions (like aptitude in Debian or pacmanin Arch Linux) except that pm doesn't fetch package from a distant location.

The Play Store is an application like others, and we can't call android applications like we call a program like a C or "normal" Java program, because the .apk file isn't actually a binary, but a simply zipped package. It is the Dalvik Virtual Machine (sort of equivalent to the Java VM) that deals with running applications. The Play Store application simply download the application you want and then run pm install on the package downloaded.

7

I was looking for the same answer, i can't find a single command to do this, but i found few options that could be useful in such cases:

A. download the .apk to your computer and install the apk from it (just google 'apk downloder' and find one suitable for you):

adb install com.myapp.apk

B. open playstore app from adb and point it to your package, this will look like this:

adb shell am start -a android.intent.action.VIEW -d 'market://details?id=com.myapp'

(i'm sure it can be automated to simulate the neccesarry clicks and install the app, but this requires much more work)

none are as easy as just installing from computer cmd, but that what we have now.

  • On Mac, Linux and recently also Windows, you can have a bash command prompt, and in there (or in your .profile settings file) you can define a function like this: adb-am () { adb shell am start -a android.intent.action.VIEW -d "market://details? id=$1" } and make sure to paste each gray block as a separate line. Then you run it with adb-am com.google.android.apps.photos – Simon B. Oct 13 '17 at 17:54
0

If you know the x and y coordinates for the install and accept buttons you can run the following after starting market pointing to app like Ohad Cohen stated

adb shell input touchscreen tap x y - x and y coordinates for install button with space inbetween

pause for a second or 2 then run

adb shell input touchscreen tap x y - x and y coordinates for accept button with space inbetween

then close play store adb shell am force-stop com.android.vending

  • Google has tried to protect Play Store (Android Market app) from enabling automatic app installs, since it could be abused to make people buy apps. Appbrainz Fast Web Installer is or was an automated solution; appbrain.com/app/fast-web-installer/… – Simon B. Oct 13 '17 at 18:00
0

One way to achieve what you want (at least partially) is to use

 pm install -i "com.android.vending" -r "path to apk"  

In the adb shell. That way, though the app is side loaded, it will appear to have been installed from play store.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.