37

For example, I want to execute this command from this tutorial:

$ adb shell monkey -p your.package.name -v 500

How do I do it? Where do I enter the command? I've tried entering it into the terminal but it says that '$' is not recognized.

I also tried removing '$' but it then says that "'adb' is not recognized as an internal or external command, operable program or batch file."

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Sid Go
  • 2,041
  • 3
  • 16
  • 29

1 Answers1

12

$ isn't part of the command. Use adb shell monkey -p your.package.name -v 500

adb is the command you ran on your terminal. For example:

adb devices

shows you the connected devices.

adb shell

Starts a remote shell in the target emulator/device instance.

See https://developer.android.com/studio/command-line/adb.html for more info about adb.

fbwnd
  • 687
  • 6
  • 12
  • 10
    Now it says: 'adb' is not recognized as an internal or external command, – Sid Go Dec 11 '16 at 14:17
  • 1
    Did you install adb? (see the link above) If you did, you probably using windows, in that case you need to define an Enviroment variable to run the adb from everywhere EDIT: See http://stackoverflow.com/questions/20564514/adb-is-not-recognized-as-an-internal-or-external-command-operable-program-or – fbwnd Dec 11 '16 at 14:19
  • Then what will be the variable name and value? Thank you. – Sid Go Dec 11 '16 at 14:20
  • See the link above, they answer that question – fbwnd Dec 11 '16 at 14:21
  • You might need to set an environment variable if it's still not working. – invot May 04 '20 at 16:08
  • 4
    Once I installed Android Studio, the location is `/home//Documents/platform-tools/adb` – Melroy van den Berg Oct 12 '20 at 23:59
  • 6
    Unless the question was edited after this answer was added, this answer misses the point, and I suspect upvotes are from folks who don't even know what adb is. The asker clarified that removing "$" did nothing - he knows that it's a terminal command. With modern Android Studio installs, there is often a disagreement between what adb version is side-installed with AS itself and what might be available system-wide (if any). If there is no magic shell or drop down menu to access the platform tools that AS itself is using, the right answer is "You can't." – jdowdell Nov 23 '21 at 04:07
  • 5
    Doesn't answer anything. It really sucks that ADB is installed automatically but AS doesn't know the path in it's own terminal. – The incredible Jan Dec 21 '21 at 10:24
  • 3
    Location of `adb` on Windows with Android Studio installed is `AppData/Local/Android/Sdk/platform-tools`. If you don't want to add this to PATH you can cd to the directory and use the command there. – Loz May 15 '23 at 10:14