Dianne, I understand but the logcat is part of adb shell. I can rum the same script if it is part of a Activity class, but fails when it is subclass of ActivityInstrumentationTestCase2.
On Mar 9, 2:06 pm, Dianne Hackborn <[email protected]> wrote: > Note that no shell commands are part of the SDK. > > > > > > On Wed, Mar 9, 2011 at 12:53 PM, gaurav <[email protected]> wrote: > > 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 > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- 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

