【问题标题】:ADB logcat fails to clear the main logadb logcat 清除主日志失败
【发布时间】:2018-07-05 10:38:09
【问题描述】:

当我使用 adb 连接到设备或模拟器时,我可以使用 adb logcat -c 清除 logcat。我面临的问题是我经常收到以下消息:

failed to clear the 'main' log

AFAIK,'main' 是一个无根缓冲区,这意味着我应该能够在没有根的情况下清除它。那么此消息的原因可能是什么?

【问题讨论】:

    标签: android adb


    【解决方案1】:

    您的 Android Studio 可能已经打开,请关闭它并再次运行,它应该能够清除日志。

    【讨论】:

    • 我会试试,但我不认为它当时是开放的
    • 关闭 IntelliJ IDEA 对我有用,我猜可能是 Android 插件导致了这个问题。
    【解决方案2】:

    使用

    adb logcat -b all -c 
    

    它将清除所有缓冲区。有时 adb logcat -c 将无法工作,因为许多进程使用它,如 android studio。

    【讨论】:

    • 这向我显示了同样的错误,但带有“事件”日志:logcat: failed to clear the 'events' log.
    • @MarcSances 有可能通过使用 -b 选项我们也将无法清除 logcat 。这可能是由于某些进程的某些锁定条件。可能是如果您可以尝试多次相同的命令。如果可能的话,如果它在这种情况下仍然不起作用,那么断开 adb 并重新连接。
    【解决方案3】:

    Logcat消息存储在缓冲区中,你可以试试,

    adb logcat -c
    

    清除(刷新)选定的缓冲区并退出。默认缓冲区集是 main、system 和 crash。要清除所有缓冲区,请使用 -b all -c。

    来源:logcat doc

    更多logcat使用请查看How do I get the logfile from an Android device?

    【讨论】:

    • 他在做同样的事情 adb logcat -c 他得到一个错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-10
    相关资源
    最近更新 更多