Android Debug Bridge commands that are frequently used in Android Software Development.
๐๐จ๐ง๐ญ๐๐ง๐ญ ๐จ๐ ๐ญ๐ก๐ข๐ฌ ๐๐ซ๐ญ๐ข๐๐ฅ๐:
- ๐๐ฌ๐ ๐๐๐ ๐ฐ๐ข๐ญ๐ก๐จ๐ฎ๐ญ ๐ฐ๐ซ๐ข๐ญ๐ข๐ง๐ ๐๐ฎ๐ฅ๐ฅ๐ฉ๐๐ญ๐ก ๐ญ๐จ ๐๐ฑ๐๐๐ฎ๐ญ๐๐๐ฅ๐
- ๐๐จ๐ง๐ง๐๐๐ญ ๐ญ๐จ ๐๐๐ฏ๐ข๐๐ ๐จ๐ฏ๐๐ซ ๐๐ข-๐
๐ข
- ๐๐๐ ๐ฎ๐ง๐๐๐ฅ๐ ๐ญ๐จ ๐๐จ๐ง๐ง๐๐๐ญ ๐ญ๐จ ๐๐๐ฏ๐ข๐๐
- ๐๐ง๐ฌ๐ญ๐๐ฅ๐ฅ, ๐๐ง๐ข๐ง๐ฌ๐ญ๐๐ฅ๐ฅ ๐๐ง๐ ๐๐จ๐ฐ๐ง๐ฅ๐จ๐๐ ๐๐ฉ๐ค
- ๐๐๐๐จ๐ซ๐ ๐ฏ๐ข๐๐๐จ ๐๐ซ๐จ๐ฆ ๐ฌ๐๐ซ๐๐๐ง
- ๐๐๐ซ๐๐๐ง๐ฌ๐ก๐จ๐ญ ๐๐๐ฉ๐ญ๐ฎ๐ซ๐
- ๐๐๐๐จ๐ซ๐ ๐๐จ๐ ๐๐๐ญ
Use ADB without writing fullpath to executable
If ADB was installed on Windows with Android Studio then executable probably located at:
1
| C://Users/{USER_NAME}/AppData/Local/Android/Sdk/platform-tools
|
By default to launch adb command user need to either move to directory with adb executable or write full path to it. To avoid it and be able to lunch adb by just typing ยซadbยป in terminal, user can edit Operation System enviroment variable PATH. This variable is used by operation system to recognize commands and operable programs.
To edit this variable on Windows:
- Press Windows button.
- Type ยซEdit the system enviroment variablesยป.
- Press ยซEnviroment Variablesโฆยป button.
- In ยซSystem variablesยป table look for ยซPathยป Varialbe.
- Select ยซPathยป varialbe and click ยซEditยป button.
- Add full path to the ADB directory.
- Restart command line utility.
After this user can lunch adb commands without writing full path to adb executable.
Simmilar thing can be done on Mac and Linux operation systems.
Connect to device over Wi-Fi
Connect
1
| adb connect 172.16.107.156:2111
|
IP adress and port of android device can be displayed on Android Notification Shade or in the Android Settings:
- Go to Developer Options
- Turn on Wireless debugging
- Look for IP address & Port
Note that PC and Android device should be connected to the same network.
List connected devices
Disconnect
ADB unable to connect to device
Some devices, especially POS-terminals and Smart TVs may not connect in a first try. The fast way to fix it is to:
- Turn off and turn on Android device Wi-Fi.
- On Android devices try to browse web.
- Restart adb:
1
2
| adb kill-server
adb start-server
|
- Double check correctness of ip adress and the fact that PC and Android device are connected to the same network. Try to connect again:
1
| adb connect 172.16.107.156:2111
|
Install, Uninstall and Download apk
Install
1
| adb install -r full_path_to_file.apk
|
List installed apps
1
| adb shell pm list packages -f com.package
|
Uninstall app
1
| adb shell pm uninstall com.package.fullname
|
Download apk from Android device
Get the full path name of the APK file for the desired package
1
| adb shell pm path com.package.fullname
|
Use this full path with pull command
1
| adb pull /data/app/com.example.fullname.apk
|
Record video from screen
Start recording
1
| adb shell screenrecord /sdcard/example.mp4
|
Stop recording
Download recording from device
1
| adb pull /sdcard/example.mp4 .
|
Remove recording from device
1
| adb shell rm /sdcard/example.mp4
|
Recording time limit is 3 minutes
Note that time limit for this utility is 3 minutes. You can make .bat file with content:
1
2
3
| adb shell screenrecord --bit-rate 8000000 /sdcard/sr1.mp4
adb shell screenrecord --bit-rate 8000000 /sdcard/sr2.mp4
adb shell screenrecord --bit-rate 8000000 /sdcard/sr3.mp4
|
to subsequently capture screen recordings for further merging into longer videos.
Screenshot capture
Take screenshot and download it on PC:
1
| adb shell screencap -p /sdcard/screencap.png && adb pull /sdcard/screencap.png
|
Screenshot will apear in current directory of terminal session.
Record LogCat
Clear logs
Save log output to file
1
| adb logcat > logcat.txt
|