에 파일을 쓰고 있어요 어디는 SD 여기
File folder = new File(Environment.getExternalStorageDirectory()+"/IssueReport/");
if (folder.isDirectory() == false) {
folder.mkdir();
}
log = new File(Environment.getExternalStorageDirectory()+"/IssueReport/log.txt");
와의 파일을 만드는 오전 곳입니다
는 입니다. 나는 Running Shell commands though java code on Android?을 발견하고 그것을 필요로하는 것처럼 수정했습니다.
private void submit() {
try {
String[] commands = {"dumpstate > /sdcard/log1.txt"};
Process p = Runtime.getRuntime().exec("/system/bin/sh -");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
for (String tmpCmd : commands) {
os.writeBytes(tmpCmd+"\n");
}
} catch (IOException e) {
e.printStackTrace();
}
누구나 필요하면 여기를 모두 함께 실행하는 방법입니다. 앱에 Running Shell commands though java code on Android?을 읽고 버그 보고서를 첨부해야합니다. 버그 보고서를 실행할 방법이 없다는 것을 알았습니다. dumpstate, dumpsys 및 log의 세 가지 구성 요소 만있었습니다. 나는 각 보고서를 개별적으로 생성하고 하나의 파일로 결합하여 전자 메일에 첨부합니다.
private void submit() {
try {
String[] commands = {"dumpstate > /sdcard/IssueReport/dumpstate.txt",
"dumpsys > /sdcard/IssueReport/dumpsys.txt",
"logcat -d > /sdcard/IssueReport/log.txt",
"cat /sdcard/IssueReport/dumpstate.txt /sdcard/IssueReport/dumpsys.txt /sdcard/IssueReport/log.txt > /sdcard/IssueReport/bugreport.rtf" };
Process p = Runtime.getRuntime().exec("/system/bin/sh -");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
for (String tmpCmd : commands) {
os.writeBytes(tmpCmd+"\n");
}
} catch (IOException e) {
e.printStackTrace();
}
다음 코드 줄을 수행하십시오. Process p = Runtime.getRuntime(). exec ("/ system/bin/sh -"); 모든 로그를 함께 제공 하시겠습니까? 내가 빈 프로젝트를 만들고 submit() 메소드를 실행하면, 이전의 어플리케이션 크래시 리포트를 쓸 것인가 ?? –