Reading Logcat within the app returns null

后端 未结 2 1624
别那么骄傲
别那么骄傲 2020-12-20 06:50

I read the other posts and can\'t figure out the \"trick\".

I looked at Log Collector but can\'t use a separate APK. I\'m basically using the same approach and I co

相关标签:
2条回答
  • 2020-12-20 07:23

    Hope this will be helpful, you don't have to create file by your self just execute the below command, to get the error info.

    Runtime.getRuntime().exec("logcat -v time -r 100 -f /sdcard/log.txt *:E");
    

    Logcat parameters options:

    -r <size in kilobytes> -> for specifying the size of file  
    -f <filename> -> file to which you want to write the logs.
    
    0 讨论(0)
  • Can you try it without the ArrayList. Just pass the command String I have implemented it in the following way (without the ArrayList). It works for me.

            String baseCommand = "logcat -v time";
            baseCommand += " MyApp:I "; // Info for my app
            baseCommand += " *:S "; // Silence others
    
            ServicesController.logReaderProcess = Runtime.getRuntime().exec(baseCommand);
    
    0 讨论(0)
提交回复
热议问题