57

I am writing an application for reporting crashes and the relevant logs. So from my application I am trying to access traces.txt and tombstones, but I am getting an error:

03-25 09:48:46.220 W/System.err(10250): java.io.FileNotFoundException: /data/tombstone/tombstone_00 (Permission denied)

I am able to access traces.txt, but not tombstones.

Brian Deragon
  • 2,929
  • 24
  • 44
learner
  • 651
  • 2
  • 7
  • 4
  • Did you use the [READ_LOGS](http://developer.android.com/reference/android/Manifest.permission.html#READ_LOGS) permission? – amccormack Jul 14 '11 at 15:04

8 Answers8

40

You can use adb tool located in your_sd_root_dir/tools. Use it like this

./adb pull path_to_file location_to_save
Mojo Risin
  • 8,136
  • 5
  • 45
  • 58
29

You can capture a full bug report in Developer Options (see Android docs). In the bug report's ZIP file, you can find tombstones and anr folders in /FS/data.

This will work with rooted and unrooted devices.

Zaffy
  • 16,801
  • 8
  • 50
  • 77
bannus
  • 405
  • 4
  • 6
  • 4
    unroot devices finnaly got /data/tombstones/ by `adb bugreport`. // android 10. // BTW `adb pull` or `adb shell` no permissions. – yurenchen Nov 27 '21 at 11:50
  • 3
    adb bugreport is the only way works for unrooted Android 10+ version phones. It will show permissions deny when using adb pull or cp to /sdcard/ folder. – StoneLam Apr 01 '22 at 06:28
26

If you get "permission denied" you can do this:

adb shell "cp /data/anr/traces.txt /storage/extSdCard/" 
adb pull /storage/extSdCard/traces.txt
Yassin
  • 1,376
  • 18
  • 18
  • 2
    I get No such file or directory when I execute `adb shell "cp /data/anr/traces.txt /storage/extSdCard/" ` and I get permission denied on adb shell `"cp /data/tombstones/traces.txt /storage/extSdCard/"` – Coder Sep 11 '15 at 07:27
  • 3
    @mundella Find an intermediate directory that works for you -- I use `/sdcard/`, and rename the file, so my script looks like: `adb shell "cp /data/anr/traces.txt /sdcard/anr_trace.txt" ; adb pull /sdcard/anr_trace.txt` – benkc Sep 14 '15 at 19:43
  • 13
    I get an error: `permission denied` – IgorGanapolsky Jun 29 '16 at 17:21
  • 1
    still get permission denied – JPM Mar 31 '17 at 16:29
14

Note: This only works with android emulators and rooted android devices.

You can first check if the file is created or not. You can do this by going in

DDMS -> File Explorer -> data -> data -> (Your Package) -> files -> (Your File)

DDMS is on right top corner of your eclipse. If the file is not present in the above mentioned path then it is not created properly but if it is still there change the path your file accordingly while accessing it eg. /data/data/(Your Package)/traces.txt

You can also pull that traces.txt file onto your desktop. Pull option is given on top bar below DDMS.

Harshad
  • 7,904
  • 3
  • 24
  • 42
12

This did it for me: adb pull "/data/anr/traces.txt"

box
  • 4,450
  • 2
  • 38
  • 38
8
adb shell "cd /data/anr && cat traces.txt" > anr.txt

This will copy traces.txt in anr.txt in your current set directory

Rachita Nanda
  • 4,509
  • 9
  • 42
  • 66
1

You should be able to get the file you need via DropBoxManager class http://developer.android.com/reference/android/os/DropBoxManager.html

The tombstone file is also copied to dropbox (at least on emulator)

Swav
  • 841
  • 8
  • 24
  • would would be the values for tag and msec in getNextEntry to get the contents of /data/anr/traces.txt ? – Stephan Steiner Sep 03 '13 at 16:45
  • The values would be something like this getNextEntry("SYSTEM_TOMBSTONE", before). Unfortunately this throws an Exception unless you are signed with the system key. – Jo Jo Oct 14 '15 at 19:36
0

Adb shell data/system/Dropbox then use ls to view files generated inside Dropbox iinside dropbox you will get crashes,anr and traces file

If you want access them create folder and open adb inside that folder and use following command adb pull data/system/dropbox