android clear log programmatically

后端 未结 2 726
感情败类
感情败类 2021-01-06 03:38

I want to get the whole log (Log.d(...)), after pressing a button to analyse some parts of our app (count something...). I\'m able to do this by the following code:

相关标签:
2条回答
  • 2021-01-06 04:19

    This code has worked for me in the past:

    Process process = new ProcessBuilder()
         .command("logcat", "-c")
         .redirectErrorStream(true)
         .start();
    
    0 讨论(0)
  • 2021-01-06 04:24

    This code has worked for me correctly which is put into @After case

         Process process = new ProcessBuilder()
            .command("logcat", "-c")
            .redirectErrorStream(true)
            .start();
    
    0 讨论(0)
提交回复
热议问题