I use the following code to read the logcat in Android.
Process process = Runtime.getRuntime().exec("logcat -v time");
Since the logcat file size is large, I have to filter the logcat messages. So I used the following code to filter logcat.
Process process = Runtime.getRuntime().exec("logcat -v time | grep -v -E \"(libloc|RPC)\"");
where (libloc|RPC) are tags.
But Grep code is not working in Android. Can anyone please help me with this?
解决方案
I got the answer. I have to use the file name to use the grep command.
Runtime.getRuntime().exec("logcat -v time -f "+logCatFile.getAbsolutePath()+ " libloc:S RPC:S")