question: public void before ( ) throws Throwable { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { ProcessBuilder processBuilder = new ProcessBuilder ( ) ; processBuilder . command ( "logcat" , "-c" ) ; processBuilder . redirectErrorStream ( ) ; Process process = processBuilder . start ( ) ; process . waitFor ( ) ; if ( process . exitValue ( ) != 0 ) { Log . e ( LOG_TAG , "Error while clearing logcat, exitValue=" + process . exitValue ( ) ) ; } } }
target:  Clear logcat buffer prior to test run.