开发者

error opening HPROF file: IOException: Unknown HPROF Version

开发者 https://www.devze.com 2023-03-10 05:16 出处:网络
I am getting the following exception when trying to open HPROF file (created by Debug.dumpHprofData) with Memory Analyzer:

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.ja开发者_开发技巧va:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

How do I resolve this?


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.

For example:

hprof-conv android.hprof mat.hprof

And then open mat.hprof in Memory Analyzer.

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


If you are using Eclipse, just change the following:

  1. Open Preferences (from the Window menu)
  2. Navigate to Android->DDMS
  3. Change the HPROF action to "Open in Eclipse"


hprof-conv tool location got changed.

It is now located at AndroidSDK/platform-tools/hprof-conv

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号