When I show the LogCat in Android, I want to clear the buffer Log programmatically.
But when I use this statement:
Runtime.getRuntime().exec("logcat -c")
It doesn't clear the buffer.
How can I solve this problem?
When I show the LogCat in Android, I want to clear the buffer Log programmatically.
But when I use this statement:
Runtime.getRuntime().exec("logcat -c")
It doesn't clear the buffer.
How can I solve this problem?
Runtime.getRuntime().exec("logcat -c")
will clear only non-rooted log buffers (main, system ..etc).
Please use Runtime.getRuntime().exec("logcat -b all -c")
to clear all the buffers (like radio, kernel..etc)
I recently faced this issue. Runtime.getRuntime().exec("logcat -c") was working on some devices & failed on few. After a lot of research...my conclusion is
Instead of depending on Logcat process and writing logs to Logcat, create one custom file in app context (/data/data//files) and write all logs to this file.