Reading Logcat within the app returns null

后端 未结 2 1644
别那么骄傲
别那么骄傲 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  -> for specifying the size of file  
    -f  -> file to which you want to write the logs.
    

提交回复
热议问题