我想輸出logcat到logs.log
文件。它的工作正常,我可以用Android中的應用程序FileManager打開它。但是如果我將手機連接到電腦,我無法訪問它。如何使文件在計算機中可見?android創建公共文件
try {
File filename = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)+"/logs.log");
filename.createNewFile();
String cmd = "logcat -d -f "+filename.getAbsolutePath();
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}