Two ways for adb to view application log logs (usb connection and wireless connection)

All commands used in this article:
Whether adb can be used: adb version
View computer connected devices: adb devices
Start command: adb start-server
Stop command: adb kill-server
Set port number: adb tcpip 8888
ip connection device: adb connect 192.168 .101.38:8888
ip disconnected: adb disconnect 192.168.101.38:8888
View application log log: adb logcat * | find "AppName"
output log to text: adb logcat | findstr AppName >D:\log.txt

One: First of all, you must have adb on your computer
. If you are a developer, the Android SDK is basically installed on your computer; we can see adb when we find the Android SDK directory.
insert image description here
If you don't have it on your computer, please install one before proceeding.

Two: Start adb
1. Open the console on the computer and enter the path where adb is located: D:\android-sdk-windows\platform-tools
insert image description here
2. Check whether adb can be used: adb version
insert image description here
3. Start the command: adb start-server (stop command : adb kill-server)
insert image description here
PS: Query the command of the device connected to the computer: adb devices
insert image description here
3. USB connection to view an application log
1. Use usb to connect the mobile phone to the computer;
2. View the log log of an application on the console: adb logcat * | find "AppName"
insert image description here
3. If you want to output the log to txt: adb logcat | findstr AppName >D:\log.txt
The log has been output to the log text of the D drive.
insert image description here

4. Check an application log through wireless connection
1. Connect the mobile phone to the computer with usb first, and use adb devices to check whether the connection is successful
insert image description here

2. Set the port number (four digits are optional): adb tcpip 8888
insert image description here

3. Disconnect the mobile phone, connect to the same wireless network as the computer, find the mobile phone IP and
use the command to connect to the mobile phone: adb connect 192.168.101.38:8888
insert image description here

4. Now you can use: adb logcat | findstr AppName >D:\log.txt
or: adb logcat * | find "AppName"
to view the log.

5. After the setting is completed, run the specified application on the mobile phone, and then you can view the log.

ps: The command to cancel the connection: adb disconnect 192.168.101.38:8888

Guess you like

Origin blog.csdn.net/a0_67/article/details/118494325