ADB commands

ADB commands

Start/ Stop ADB server

If a device is connected start the adb server to be able to interact with the device.

adb start-server

adb kill-server

List connected devices

adb devices
Will list all connected devices.

Reading log files

adb logcat
Print the current device log to the console.

adb logcat -d > [path_to_file]
Save the logcat output to a file on the local system.

adb logcat -c
The parameter -c will clear the current logs on the device.

adb logcat packagename:[priority level: V, D, I, W, E, F, S]
Filter log files by priority e.g. adb logcat com.myapp:E which prints all error logs of the given app.

adb bugreport > [path_to_file]
Will dump the whole device information like dumpstate, dumpsys and logcat output.

Pull files from device

adb pull [device file location] [local file location]
Will pull the given file from the device to the local computer system.

Write files to device

adb push [local file location] [device file location]
Will push a file to the connected device.

Create a screenshot

adb shell screencap -p /sdcard/screenshot.png
Will create a screenshot of the current screen on the given file location.

Create screen recordings

adb shell screenrecord /sdcard/NotAbleToLogin.mp4
Will start a recording of the current screen. With crtl+c the current recording can be stopped.

Un-/ Install apps

adb install com.myAppPackage
Install the app with the given package name on the connected device.

adb -s [device serial] install com.myAppPackage
Install the app to a specific device. Useful if more than one device is connected to your computer.

adb -r install com.myAppPackage
Very important command! The parameter -r means re-install the app and keep its data on the device. Executing this command is simulating the app update process from an older to the latest version of your app. Make sure the current live version is installed on the test device and then install the release candidate with the option -r. Check for problems after simulating the update process.

adb devices | tail -n +2 | cut -sf 1 | xargs -IX adb -s X install -r com.myAppPackage
Install the given app on all connected devices.

adb uninstall com.myAppPackage
Remove the given app from the device.

adb devices | tail -n +2 | cut -sf 1 | xargs -IX adb -s X uninstall com.myAppPackage
Uninstall the given app from all connected devices

Monkey

adb shell monkey -p com.myAppPackage -v 10000 -s 100
With the help of this command the monkey tool is generating 10.000 random events on the real device. 

Note: Use the parameter -s (seed) to execute the same commands over and over again in order to reproduce any crashes that happen during the monkey run.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章