String shell = "logcat";
try
{
Process process = Runtime.getRuntime().exec(shell);
InputStream inputStream = process.getInputStream();
boolean sdCardExist = Environment.getExternalStorageState().equals(
android.os.Environment.MEDIA_MOUNTED);
File dir = null;
if (sdCardExist)
{
dir = new File(Environment.getExternalStorageDirectory().toString()
+ File.separator + "logcatwyx.txt");
if (!dir.exists())
{
dir.createNewFile();
}
}
byte[] buffer = new byte[1024];
int bytesLeft &
Android写Logcat文件保存到SD卡
最新推荐文章于 2023-05-12 16:03:57 发布
该博客介绍了如何通过shell命令获取运行中的logcat进程PID,并执行终止命令,以实现Android设备上Logcat日志的保存操作。
摘要由CSDN通过智能技术生成