Reading Logcat within the app returns null

早过忘川 提交于 2019-11-29 12:27:25

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);
Manas

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.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!