検索したところ、次のコードを使用すると、プログラムが Android で logcat の出力を読み取ることができることがわかりました。ここの多くの投稿がこれが機能すると言っているため、実際に何が起こったのかわかりません:<
public void Collector_logcat(){
String stringbuffer="";
String command="logcat -d";
String command_c="logcat -c";
System.out.println("logcat called\n");
try{
m_logcatprocess=Runtime.getRuntime().exec(command);
m_logcat_inputreader=new InputStreamReader(m_logcatprocess.getInputStream());
m_logcat_reader=new BufferedReader(m_logcat_inputreader);
while((stringbuffer=m_logcat_reader.readLine())!=null){
System.out.println(stringbuffer+"\n");
}
Runtime.getRuntime().exec(command_c);
}
catch(Exception ex){
System.out.println(ex.getMessage());
System.out.println("error in Collector_logcat\n");
}
return ;
}