无法将Android Studio生成的HPROF文件转换为MAT格式

3
当我尝试在Android Studio终端将HPROF文件转换为MAT格式时:
1)hprof-conv [-z] d:/dump.hprof d:/outfile.hprof
2)hprof-conv d:/dump.hprof d:/outfile.hprof
我得到了相同的答案:

Usage: hprof-conf [-z] infile outfile

-z: exclude non-app heaps, such as Zygote

Specify '-' for either or both files to use stdin/stdout.

Copyright (C) 2009 The Android Open Source Project

This software is built from source code licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

See the associated NOTICE file for this software for further details.

但是在安卓平台工具中并没有hprof-conf命令。

我该怎么做才能转换文件呢?

2个回答

7

我遇到了这个问题,它与权限有关。

可以通过将输入的.hprof文件复制到“platform-tools/”目录中,并指定输出文件在没有权限的地方来解决此问题。

例如:

hprof-conv in.hprof C:/Users/whatever_name/Desktop/out.hprof


3
我也曾被这个问题困扰了很长时间。看起来您已经找到了hprof-conv.exe并按照正确的方式运行它。对我有用的方法是将文件放入“platform-tools/”中,然后像这样运行它:
hprof-conv myinputdump.hprof myoutputdump.hprof
当我像这样编写命令时,就会得到您的响应: hprof-conv ~/in.hprof ~/out.hprof
在命令中任何地方都没有使用-z选项。因此,只需使用hprof-conv,然后是文件名和输出文件名。我知道包括路径字符如“~/”和“D:/”不应该有影响,但是对我而言,排除它们是有效的,它可能对您也管用。

我写了像 hprof-conv ~/in.hprof ~/out.hprof,然后尝试使用 hprof-conv in.hprof out.hprof。但是不起作用。关于许可证的问题,我写了相同的答案。也许我应该下载许可证,但在哪里以及如何下载呢? - Delphian

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接