This is my worked version:
try {
File filename = new File(Environment.getExternalStorageDirectory()+"/logfile.log");
filename.createNewFile();
String cmd = "logcat -d -f "+filename.getAbsolutePath();
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
find your logfile /sdcard/logfile.log
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…