am5a03
am5a03

Reputation: 587

How can you view the actual Bitmap on Android Studio 3.2?

I know there is a nice feature which you can view the actual Bitmap from heap dump prior to Android Studio 3, but seems gone. enter image description here

Ref

https://stackoverflow.com/a/40945553/827785

Upvotes: 4

Views: 1128

Answers (1)

am5a03
am5a03

Reputation: 587

Got an answer from Android Studio team's profiler lead:

The “view bitmap” feature is still there (for Android 5.0 to 7.1): in heap dump, when you select a Bitmap (or related) class and then an instance, you'll see an extra tab titled “Bitmap Preview” in the instance details panel (next to the “References” tab). That has the bitmap you want.

However, there's a caveat: At some time during the Oreo (Android 8.0) timeframe, there was a change to Android's HPROF serialization to NOT include the bitmap contents. The reason is technical: HPROF is a snapshot of the Java heap, not the native heap, but bitmap contents actually reside within the native heap. In essence, older Android versions were breaking the spec in order to provide a convenience, and this "loop hole" has since been closed.

It’s definitely on our to-do list to investigate ways to foreground that information once again in Oreo and newer Android versions.

https://www.reddit.com/r/androiddev/comments/av3lhx/were_on_the_engineering_team_for_android_studio/ehhlfdt

Upvotes: 6

Related Questions