There was an ANR in the test today. My own mobile phone has no problem, but it is very annoying, and I can't locate the location.
So I still have to use the ADB connection to take a look at it. I used it before, but I always forget it. Let me summarize it today.
The above link is a summary of some commonly used passwords written after using adb before.
The troubleshooting of ANR is generally more troublesome than crash, after all, the logcat of Android Studio cannot see it.
Open the console, windows system win+r input cmd, then enter;
On mac, you can right click on the corresponding folder and select it.
The first one: View Crash
Of course, if you want to use adb, you can also check:
adb logcat > crash.log
This password will be generated in which directory you run it in the file directory! (This thing will keep refreshing the latest logs, which is a bit annoying)
You can search for keywords: such as your class name, crash and other words to check. Of course, I think this is not as good as AndroidStudio's logcat.
The second: view ANR
Run the password: adb bugreport .
The generation time of this one will be longer, because it is very comprehensive. It is a compressed package, decompression is the above file
But I used it to watch ANR, so I found it inside
Open the file below, find keywords in it, and then you can locate the problem. For example, the method below uses a third-party library. As a result, it does not fit on some mobile phones and freezes.
Of course, if you want to see the crash, find the file in FS/data/tombstones and find the log with the closest time point.