I am trying to get the logcat log on failure of the test. Following is
code snippet :
final StringBuilder log = new StringBuilder();
try{
Runtime runtime = Runtime.getRuntime();
Log.d(TAG, "runtime memory: " + runtime.freeMemory());
Process process = runtime.exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(new
InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null){
log.append(line);
log.append(LINE_SEPARATOR);
Log.d(TAG, line);
}
}
catch (IOException e){
Log.e(TAG, "CollectLogTask.doInBackground failed", e);//
$NON-NLS-1$
}
But here bufferReader always returns null, though it doesn't give any
error. If same code I run in any activity class it works.
Any solution?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en