Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I execute an adb command in Android Studio? [duplicate]

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."

like image 281
Sid Go Avatar asked Dec 11 '16 14:12

Sid Go


People also ask

How do I run multiple adb shell commands?

But, in order to execute several commands in one line, you may use adb shell "cmd1;cmd2;cmd3" . The && command mentioned by @Rachit is not quite right, because in the case adb shell "netcfg && ps && getprop" , command ps will be executed only when netcfg is executed without error raised.

Can I run adb commands on Android?

For devices running Android 10 or older, ADB over WiFi can be enabled after some initial setup from a PC. That means on older Android versions, you'll still need to go through the process to set up ADB on your PC. Once you do that, you can then have the app send commands to the ADB server started on the device.


1 Answers

$ 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.

like image 96
fbwnd Avatar answered Oct 09 '22 08:10

fbwnd