Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to read '/data/anr/traces.txt' in samsung S2

I am developing an application and it keeps crashes randomly. I finally catch the logcat when it crashes.

here are the lines I got

01-30 01:04:47.281    2856-2856/com.snappext:hascode_process I/System.out﹕ Done
01-30 01:05:02.617    2856-2861/com.snappext:hascode_process I/dalvikvm﹕ threadid=3: reacting to signal 3
01-30 01:05:02.640    2856-2861/com.snappext:hascode_process I/dalvikvm﹕ Wrote stack traces to '/data/anr/traces.txt'
01-30 01:05:39.304    2750-2752/com.snappext D/dalvikvm﹕ GC_CONCURRENT freed 830K, 14% free 11618K/13383K, paused 1ms+3ms

now I need to know how to read '/data/anr/traces.txt' I am using my Samsung S2 for testing

like image 676
Rehab Saad Avatar asked Jan 30 '15 00:01

Rehab Saad


3 Answers

you can use this cmd

adb pull /data/anr/traces.txt

you will need to navigate to adb folder under android installation

like image 51
John Donvan Avatar answered Oct 15 '22 20:10

John Donvan


You might try to do a adb shell "ls /data/anr" which will list all the the trace files in that directory. Atleast on my device I don't have permission to list the /data folder but I do for /data/anr

On my LG G3, despite the message saying it wrote to /data/anr/traces.txt it would in fact keep several. Could be Xamarin/Mono I'm developing with doing this but the file I needed was actually /data/anr/traces_<PKG_NAME>.txt where <PKG_NAME> is the Android Package of the App but with each . replaced with a _ (ex: com.my.project -> com_my_project).

It also kept other trace files, presumably for non-debugging apps, with the pattern traces00.txt, traces01.txt, ... traces10.txt. In short there wasn't a 'normal' traces.txt file in that folder, but many starting with 'traces' and ending in '.txt'

like image 24
Russ Avatar answered Oct 15 '22 19:10

Russ


If you're using Windows:

  1. Open cmd / terminal
  2. cd to SDK folder (see: Find SDK location from Android Studio)

    • Windows: cd c:/android-sdk
    • OSX: cd /Users/<user>/Library/Android/sdk
  3. cd platform-tools

  4. adb pull /data/anr/traces.txt
  5. Check c:/android-sdk/platform-tools/traces.txt

On step 4 you can get some errors:

  • adb not found in OS X terminal
  • error:more than one device and emulator
like image 3
RominaV Avatar answered Oct 15 '22 19:10

RominaV