error opening HPROF file: IOException: Unknown HPROF Version

36,123

Solution 1

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.

Solution 2

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"

Solution 3

hprof-conv tool location got changed.

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

Share:
36,123
Asahi
Author by

Asahi

Updated on January 02, 2020

Comments

  • Asahi
    Asahi over 4 years

    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)
    

    How do I resolve this?

  • smith324
    smith324 over 12 years
    @inazaruk hprof-conv used to run automatically when clicking the dump button, I'm not sure which version of ADT this stopped working but its likely a bug
  • inazaruk
    inazaruk over 12 years
    @smith234, It might be true for the button in DDMS. But when Debug.dumpHprofData() is used the conversion should be done manually.
  • IgorGanapolsky
    IgorGanapolsky over 12 years
    I was getting a 'permission denied' error in the tools directory nevertheless. I had to chmod permissions in that directory in order for it to work.
  • Weblance
    Weblance about 12 years
    Typo: the latest version of MAT requires that the filename extension is hprof, not hpof as in the example above.
  • Paulius Vindzigelskis
    Paulius Vindzigelskis about 12 years
    In Windows 7 64bit, I couldn't convert using hprof-conv tool, it just didn't nothing. So tried your method and it works! I just should have to install MAT to eclipse and it now works perfectly. thanks
  • Mick
    Mick about 12 years
    It might be good to update to explain that the user should open Eclipse preferences first and then select Android from the left hand menu etc
  • Kev
    Kev over 10 years
    I get "ERROR: failed reading input" when trying to convert. Any idea? I use Android Debug Monitor 21.1.0 to produce the heap dump
  • joecks
    joecks almost 10 years
    in Luna I needed to install MAT manually: Help-> Install New Software: download.eclipse.org/mat/1.4/update-site
  • cjayem13
    cjayem13 almost 10 years
    just a heads up, my hprof-conv was under sdk\platform-tools instead in case anyone missed it under sdk/tools
  • Kushal
    Kushal about 9 years
    I followed every step, on ubuntu but still am getting error "hprof-conv command not found" can anybody help stackoverflow.com/q/29489190/1994950
  • Neph
    Neph almost 6 years
    In my Eclipse Mars.2 (4.5.2) (Win 10) "Open in Eclipse" is already set and MAT is installed, yet I still get the "unknown HPROF version" error. I had to convert the file with "hprof-conv".