ADB Notes
ADB Notes
ADB Notes
Command redirection
Monkey tool
“In some cases, you might need to terminate the adb server process and then restart it
adb kill-server
You can then restart the server by issuing any other adb command.”
To make sure the device you are going to manipulate with is actually connected, always
start with
adb devices
emulator -list-avds - returns the list of created emulators on your machine (their names)
Note: the very first link How ADB Works has the steps as well
Steps:
1. Your phone and computer are ON THE SAME WiFi
3. adb devices
How to find ip from command line (alternatively, search in the phone settings)
Command redirection
if more than one device or more than one emulator connected, use
For ex.,
adb -s emulator-5554 install .apk
adb devices | grep device | grep -v devices | cut -f 1 | xargs -I {} adb -s {} install
Unistall
adb shell pm list packages - returns the list of packages installed on the device
adb shell pm list packages -f <app_name> - returns the package for the specific app
adb shell pm list packages -3 -returns third party packages that were installed from Play
Alternatively, with dumpsys. First start the app do that it is running on the foreground, then
Returns
mCurrentFocus=Window{2c0df8a u0
com.adjoy.standalone.test2/com.adjoy.standalone.features.auth.AuthActivity}
useful options:
adb logcat -c clears all the info that might be in buffer from the previous sessions
adb logcat | grep ‘adjoy’ - filter the log for a particular application
n Windows machine, please use find instead of grep - for ex., find “adjoy”
Note: O
Note: I f you need to grep more than one word, please do the following:
adb logcat > file_name.txt - writes the log a text file (or -f <file_name>), for example,
n Windows machine, please use f ind instead of grep - for ex., find “adjoy”
Note: O
adb logcat | tee logfile.txt - prints the output in the console and also saves to a file
Note: if you use zsh, you need to use single quotes a
round the expression '*:W'
n Windows machine, please use f ind instead of grep - for ex., find “adjoy”
Note: O
give your files a meaningful name. You may use a bug # as a file name, too.
Default recording time is 180 seconds (3 minutes). You may, however, change the that
instead of <TIME> placeholder, insert the needed time in seconds: --time-limit 120 will
specified destination
If no distention directory specified, the file will be stored at your current working
https://developer.android.com/studio/debug/am-video.html?hl=en
directory
Remember - we can also do it in the emulator settings and in Android Studio (under
Desktop
Note: You may drag and drop file from your computer to your emulator, that includes
android.permission.CAMERA: granted=true
means the user is currently allowing the app to access the camera
The same way you can revoke and grant any RUNTIME permission your application
“dumpsysis a tool that runs on Android devices and provides information about system
services”
adb shell getprop - returns the list of the devices properties; could be useful when you
need to get, say, a device model or Android version
adb shell getprop ro.build.version.release - returns Android version installed one the
device, for example, Android 8.0
adb shell getprop ro.build.version.sdk - returns API level, for example, 27
adb shell pm clear com.adjoy.standalone.test2 - clears all package data from the
device; after running this command, the is if it were just installed
For example,
adb shell am start
com.adjoy.standalone.test2/com.adjoy.standalone.features.auth.AuthActivity
Monkey tool
“The M
onkey is a program that runs on your emulator or device and generates
pseudo-random streams of user events such as clicks, touches, or gestures, as well as
a number of system-level events.”
adb shell monkey -p com.adjoy.standalone -v 500 - sends 500 random clicks and
touches to Dabbl app