how to access android files /data/anr/traces.txt a

2019-01-30 05:05发布

This question already has an answer here:

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.

8条回答
地球回转人心会变
2楼-- · 2019-01-30 05:27

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

adb shell "cp /data/anr/traces.txt /storage/extSdCard/" 
adb pull /storage/extSdCard/traces.txt
查看更多
beautiful°
3楼-- · 2019-01-30 05:27

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 with rooted and unrooted devices.

查看更多
做自己的国王
4楼-- · 2019-01-30 05:28

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

./adb pull path_to_file location_to_save
查看更多
爷、活的狠高调
5楼-- · 2019-01-30 05:30
adb shell "cd /data/anr && cat traces.txt" > anr.txt

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

查看更多
Lonely孤独者°
6楼-- · 2019-01-30 05:31

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)

查看更多
男人必须洒脱
7楼-- · 2019-01-30 05:35

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

查看更多
登录 后发表回答