how to access android files /data/anr/traces.txt and /data/tombstones/tombstones [duplicate]

天大地大妈咪最大 提交于 2019-12-18 10:04:33

问题


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.


回答1:


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

./adb pull path_to_file location_to_save



回答2:


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

adb shell "cp /data/anr/traces.txt /storage/extSdCard/" 
adb pull /storage/extSdCard/traces.txt



回答3:


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.




回答4:


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.




回答5:


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




回答6:


adb shell "cd /data/anr && cat traces.txt" > anr.txt

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




回答7:


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)




回答8:


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



来源:https://stackoverflow.com/questions/5467972/how-to-access-android-files-data-anr-traces-txt-and-data-tombstones-tombstones

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!