【问题标题】:How to get android application traces.txt file from android device [duplicate]如何从android设备获取android应用程序traces.txt文件[重复]
【发布时间】:2017-08-08 15:15:19
【问题描述】:

我想从 android 设备中获取我的应用程序 traces.txt 文件。我在谷歌中检查了很多链接,但仍然没有成功。如果有人有任何想法,请帮助我。 我还检查了以下链接。 how to access android files /data/anr/traces.txt and /data/tombstones/tombstones How to find this stack trace?

我也在尝试这个。 adb -s 0123456789ABCDEF shell #

ps | grep com.package.name # This will list some info about the running         instance of your app
# Output should be something like: 
# u0_a7    18941 173   869348 26040 ffffffff 00000000 S    com.package.name
# Important is the PID (number in the second column), in this case 18941.

# Now send the SIGQUIT to your process, please change '18941' to your PID
run-as com.package.name kill -3 18941

# Now Android should have created the file /data/anr/traces.txt, check that:
ls -l /data/anr/traces.txt 
# Output should be something like
# -rw-rw-rw- system   system     325391 2014-02-03 14:11 traces.txt

# And finally pull that file
exit

adb -s 0123456789ABCDEF pull /data/anr/traces.txt

但我收到此错误“运行方式:包 'com.package.name' 安装已损坏。”

【问题讨论】:

  • 在物理设备中,您无法获取此 traces.txt,直到您的设备植根。

标签: android


【解决方案1】:

你可以使用 adb 做同样的事情:

adb pull /data/anr/traces.txt

【讨论】:

  • 但是如何用这个命令添加包名呢?
  • 将您的设备与PC连接并运行命令,此跟踪文件将复制到平台工具目录
  • 所有应用程序的traces.txt文件的默认路径
  • 但它显示“无法将'/data/anr/traces.txt'复制到'./traces.txt':权限被拒绝”。
  • 试试这个 adb shell ---> cd data/anr 和 cat traces.txt
【解决方案2】:

试试这个。

// start tracing to "/sdcard/calc.trace"
Debug.startMethodTracing("Name of yours");
// ...
// stop tracing
Debug.stopMethodTracing();

它将跟踪详细信息存储在 SDCArd 中

更多详情请看以下链接

http://developer.android.com/guide/developing/debugging/debugging-tracing.html

【讨论】:

    【解决方案3】:

    您也可以从非 root 物理设备获取 traces.txt。您需要将其复制到 sdcard(或设备上任何可访问的位置)上,然后从那里复制。打开您的终端并按照以下步骤操作:

    ./adb shell
    cat /data/anr/traces.txt.bugreport  > /sdcard/traces.txt
    ./adb pull /sdcard/traces.txt
    

    希望这会有所帮助! :)

    【讨论】:

      【解决方案4】:

      这将在你当前设置目录的 anr.txt 中复制 traces.txt

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-05-01
        • 2014-09-21
        • 2014-10-19
        • 2015-01-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多