Last active
June 17, 2022 16:07
-
-
Save vtarantik/4bec3d3e38522f76445454af38e91b9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Restart adb in case the device is ie. invisible | |
adb kill-server; adb start-server | |
//Install single .apk file | |
adb install *.apk | |
//Install multiple apks at once (for split apks) | |
adb install-multiple 1.apk 2.apk | |
//Uninstall application | |
adb uninstall [com.package.name] | |
//Open logcat where [level] is one of | |
V: Verbose (lowest priority) | |
D: Debug | |
I: Info | |
W: Warning | |
E: Error | |
F: Fatal | |
S: Silent (highest priority, on which nothing is ever printed) | |
adb logcat *:[level] | |
//Simulates the keypress/event from the user. Codes can be found here: https://developer.android.com/reference/android/view/KeyEvent | |
adb shell input keyevent | |
//Run activity with a specified package name | |
adb shell am start -n com.package.name/.ActivityName | |
//List package names installed on a device | |
adb shell 'pm list packages -f' | |
//Get Android version of the device | |
adb shell getprop ro.build.version.release | |
//Get Android API level of the device | |
adb shell getprop ro.build.version.sdk | |
//Start activity with a category and a flag | |
adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME -f 268435456 | |
//Clear app data | |
adb shell pm clear my.app.package.name | |
//Control density and screen size of the device | |
adb shell wm | |
usage: wm [subcommand] [options] | |
wm size [reset|WxH|WdpxHdp] | |
wm density [reset|DENSITY] | |
wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM] | |
wm scaling [off|auto] | |
wm screen-capture [userId] [true|false] | |
wm size: return or override display size. | |
width and height in pixels unless suffixed with 'dp'. | |
wm density: override display density. | |
wm overscan: set overscan area for display. | |
wm scaling: set display scaling mode. | |
wm screen-capture: enable/disable screen capture. | |
wm dismiss-keyguard: dismiss the keyguard, prompting the user for auth if necessary. | |
//Force stop the app | |
adb shell am force-stop com.my.app.package | |
//Switch adb to root | |
adb root | |
//Disable the app (should run as a root) | |
adb shell pm disable com.google.android.tvlauncher | |
//Rotate the screen | |
adb shell settings put system accelerometer_rotation 0 | |
adb shell settings put system user_rotation 0-3 | |
//Get screen orientation | |
adb shell dumpsys input | grep 'SurfaceOrientation' | awk '{ print $2 }' | |
//Show battery stats | |
adb shell dumpsys batterystats | |
//Enable network debugging on a USB connected device | |
adb -d tcpip 5555 | |
//Connect to network debugging enabled device | |
adb connect 192.168.0.101:5555 | |
//Upload files to the phone | |
adb push <source-path-on-pc> <target-path-on-mobile> | |
//Download files from the phone | |
adb pull <source-path-on-mobile> <target-path-on-pc> | |
//Copy-paste text from PC to phone | |
adb shell input text 'Some long text' | |
//Enable/disable app possibility to draw over other apps | |
adb shell appops set <package name> SYSTEM_ALERT_WINDOW allow/ignore | |
//Get version number of the app | |
adb shell dumpsys package my.package | grep versionName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment