android debugging tool adb command

  • 2020-05-27 07:11:49
  • OfStack

1. adb is introduced
The Tools folder of SDK contains the important command adb for Android simulator operation. adb is called Android Debug Bridge for debugging bridge. With adb, we can debug the Android program with DDMS in Eclipse. With this tool, we can manage the state of the device or the phone emulator. You can also do the following:

1. Quickly update the code in the device or mobile phone simulator, such as app or Android system upgrade;
2. Run shell command on the device;
3. Manage the scheduled port on the device or mobile phone simulator;
4. Copy or paste files on the device or phone simulator;
2. adb working in an integrated development environment
adb works by listening to ports such as Socket TCP 5554 to enable IDE to communicate with Qemu. By default, adb will be connected to daemon network ports, so when we run Eclipse, the adb process will run automatically.
1. The Linux Shell command can be easily executed through adb, such as adb shell dir, which is the listing directory. In Linux, the root directory is/instead of C disk or D disk on Windows.
2. Install the apk program into the simulator and execute adb install android123.apk, so that the installation package named android123 will be installed into the Android simulator, provided that the android123.apk file needs to be placed in the SDK/Tools directory.
3. Transfer files to emulator, adb push android123.txt /tmp/ android123.txt command can be used to transfer SDK/Tools android123.txt SDK/ tmp/ android123.txt SDK/Tools android123.txt files to the /tmp/ folder of the emulator. Please note that the contents of /tmp/ folder will be cleared when the Android emulator is restarted.
4. Send the file back to the computer from the Android emulator
The adb pull /tmp/ android123.txt android123.txt command will return the android123.txt file in the tmp folder of the simulator to the SDK/Tools directory on the computer.
3. adb
1. All Android platforms in the display system:
android list targets
2. Display all AVD (simulator) in the system:
android list avd
3. Create AVD (emulator) :
android create avd --name name --target platform number
4. Start the simulator:
emulator-avd name -sdcard ~/ name.img (-skin 1280x800)
5. Delete AVD (emulator) :
android delete avd -- name of name
6. Create SDCard:
mksdcard 1024M ~/ name.img
7. Location of AVD(simulator) :
Linux(~/.android/avd) Windows(C:\Documents and Settings\Administrator\.android\avd)
8. Launch DDMS:
ddms
9. Display all the simulators currently running:
adb devices
10. Execute commands on a 1 emulator:
abd-s simulator number command
11. Install the application:
adb install -r application.apk
12. Get files in the simulator:
adb pull < remote > < local >
13. Write files to the simulator:
adb push < local > < remote >
14. Enter the shell mode of the simulator:
adb shell
15. Launch SDK, document, instance download manager:
android
16. Contents of apk pack:
adb shell
cd data/app
rm apk package
exit
The main package name of the adb uninstall apk package
adb install -r apk package
17. View the adb command help information:
adb help
18. View LOG information on the command line:
adb logcat -s tag name
19. adb shell is mainly followed by:
Source code \system\core\toolbox directory and source code \frameworks\base\cmds directory.
20. Delete system application:
adb remount (remount the system partition to make the system partition writable again).
adb shell
cd system/app
rm *.apk
21. Get administrator privileges:
adb root
22. Launch Activity:
adb shell start start n package name/package name + class name (-n class name, -a action, -d date, -m MIME-TYPE, -c category, -e extended data, etc.)
23. Release port:
You can set any port number as a request port for the host to the emulator or device. Such as:
adb forward tcp:5555 tcp:8000
24. Copy files:
You can copy files to or from a device,
Copy 1 file or directory to device or emulator:
adb push < source > < destination > < /destination > < /source >
adb push test. txt /tmp/ test. txt
Copy 1 file or directory from the device or emulator:
adb pull < source > < destination > < /destination > < /source >
Such as: adb pull addroid/lib/libwebcore so.
25. Example of search simulator/device:
Get a list of instances of the currently running emulator/device and the status of each instance:
adb devices
26. See bug report:
adb bugreport
27. Record the wireless communication log:
1. Generally speaking, there is a lot of wireless communication logs, so there is no need to record them when running, but we can still set the record by command:
adb shell
logcat -b radio
28. Get the ID and serial number of the device:
adb get-product
adb get-serialno
29. Access to database SQLite3
adb shell
sqlite3
Enter the specified folder in the system
The #ls // list displays the contents of the current folder
Delete the folder named xxx and all the files in it
#rm xxx // delete the file xxx
#rmdir xxx // delete the xxx folder


Related articles: