I searched for N multiple solutions on the Internet, but many of them set the Log Level and usage to filter and view logs in logcat, however, the problem I encountered was that the simulator was okay, but the log information was not visible during development and debugging on real machines and mobile phones, this is annoying (after all, the simulator runs too slowly ).
If no good method is found at the beginning, try catch to hit the exception to an alertdialog. However, it is useless to look around this circle, finally, I saw the solution on the EOE forum. I am afraid the reason is that Rom itself has not enabled the log switch.
Problem: after connecting the mobile phone to the computer, the driver is correctly installed and the USB debugging mode is enabled. The device and its process information can be seen in ddms, but no information is output in logcat.
Cause: logcat is disabled by default in some rom
Problem description: In ddms, the display of the device name as a question mark does not affect, that is, the display of ADB get-serialno as a question mark does not affect.
Solution:
1. Root permission required (not required for some rom)
2. Open logcat, set the level, and run the following command (after Android upgrade, ADB is in platform-tools, not in tools)
ADB Shell
Echo 1>/sys/kernel/logger/log_main/enable
Note: 1 is written to the log switch file, 1 is on, and 0 is off.
Echo 2>/sys/kernel/logger/log_main/Priority
Description: writes level 2 to priority files.
3. Restart ADB. If eclipse is used, disable eclipse, restart ADB, and then start eclipse.
ADB kill-Server
ADB start-Server
4. logcat should be able to work now. If it still does not work, update ADB
Android update ADB
5. Repeat Step 3. At this time, logcat should be able to work. If it still does not work, find the android directory in your home directory, such as c: \ Documents ents and Settings \ Administrator \. Android.
Find the adb_usb.ini file in this directory. The content of the file is only three lines by default, all of which are comments. Add a line after it and the content is 0x12d1.
6. Repeat Step 3. logcat should be ready to work now.