When I connect to a device or an emulator using adb, I can clear logcat using
adb logcat -c. The issue I am facing is that I often get the following message:
failed to clear the 'main' log
AFAIK, ‘main’ is a non-rooted buffer which means that I should be able to clear it without root. What can then be the reason for this message?
You might have your Android Studio opened, please close it and run again , it should able to clear the logs.
adb logcat -b all -c
it will clear all buffers. sometime adb logcat -c will not work because of many process using it like android studio.
Logcat messages are stored in buffer, you can try,
adb logcat -c
Clear (flush) the selected buffers and exit. The default buffer set is main, system and crash. To clear all of the buffers, use -b all -c.
source: logcat doc
For more logcat usage, check How do I get the logfile from an Android device?