如何在 Android Studio 3.2 上查看实际位图?
How can you view the actual Bitmap on Android Studio 3.2?
我知道有一个很好的功能,您可以在 Android Studio 3 之前从堆转储中查看实际位图,但它似乎已经消失了。
参考
从 Android Studio 团队的探查负责人那里得到了答案:
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.
我知道有一个很好的功能,您可以在 Android Studio 3 之前从堆转储中查看实际位图,但它似乎已经消失了。
参考
从 Android Studio 团队的探查负责人那里得到了答案:
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.