本文介绍了打开HPROF文件时出错:IOException:未知的HPROF版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Memory Analyzer打开HPROF文件(由Debug.dumpHprofData创建)时,出现以下异常:

I am getting the following exception when trying to open HPROF file (created by Debug.dumpHprofData) with Memory Analyzer:

java.io.IOException: Unknown HPROF Version (JAVA PROFILE 1.0.3)
at org.eclipse.mat.hprof.AbstractParser.readVersion(AbstractParser.java:124)
at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:69)
at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:65)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:203)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:114)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:143)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:123)
at org.eclipse.mat.ui.snapshot.ParseHeapDumpJob.run(ParseHeapDumpJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

我该如何解决?

推荐答案

从Android获取的hprof文件具有android特定格式.您应该将来自Android OS的hprof文件转换为标准hprof格式.为此,您可以使用位于AndroidSDK/tools/hprof-convhprof-conv工具.

The hprof file you get from Android has android specific format. You should convert hprof file take from Android OS into standard hprof format. For this you can use hprof-conv tool that is located at AndroidSDK/tools/hprof-conv.

例如:

hprof-conv android.hprof mat.hprof

然后在内存分析器中打开mat.hprof.

And then open mat.hprof in Memory Analyzer.

hprof-conv在某些软件包中可能位于AndroidSDK/platform-tools/下.

hprof-conv might be located under AndroidSDK/platform-tools/ in some bundles.

这篇关于打开HPROF文件时出错:IOException:未知的HPROF版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 17:55