Tencent/matrix · error · RuntimeException
Unable to determine bitmap configuration
Error message
Unable to determine bitmap configuration
What it means
BitmapDecoder.getBitmap reads the bitmap's config name from the heap dump via BitmapDataProvider.getBitmapConfigName(); if it returns null, the decoder cannot know the pixel format and cannot render the leaked bitmap, so it throws RuntimeException. Matrix throws this because bitmap decoding depends entirely on knowing the Bitmap.Config.
Solutions
- Upgrade matrix-resource-canary to match the Android SDK level of the hprof being analyzed
- Re-capture the heap dump and confirm the bitmap is still valid (not recycled) at dump time
- Check that no obfuscation stripped Bitmap config fields in the dumped app
Defensive patterns
Strategy: try-catch
Validate before calling
String config = dataProvider.getBitmapConfigName();
if (config == null) { skipDecoding(dataProvider); } Type guard
boolean hasBitmapConfig(BitmapDataProvider p) { return p.getBitmapConfigName() != null; } Try / catch
try { BufferedImage img = BitmapDecoder.getBitmap(provider); } catch (RuntimeException e) { if (e.getMessage().contains("Unable to determine bitmap configuration")) { reportNoPreview(); } } Prevention
- Capture hprofs with an analyzer matching the target Android version
- Avoid decoding recycled bitmaps
- Prevent obfuscation of Bitmap fields in analyzed builds
When it happens
Trigger: The hprof contains a Bitmap whose mBitmap/mConfig field chain is missing or unresolvable, so getBitmapConfigName() returns null.
Common situations: Heap dumps from Android versions where the Bitmap field layout differs from what the analyzer expects; recycled or already-cleared bitmaps in the dump; obfuscated/renamed Bitmap fields.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unable to determine image dimensions.
- Unsupported bitmap configuration
- Unable to create scaled bitmap
- Unable to obtained scaled bitmap's dimensions
- Could not find char array in
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/4b37aafb5678528f.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-analyzer-cli/src/main/java/com/tencent/matrix/resource/analyzer/utils/BitmapDecoder.java:68
protected static final Map<String, BitmapExtractor> SUPPORTED_FORMATS = new HashMap<>();
static {
SUPPORTED_FORMATS.put("\"ARGB_8888\"", new ARGB8888_BitmapExtractor());
SUPPORTED_FORMATS.put("\"RGB_565\"", new RGB565_BitmapExtractor());
SUPPORTED_FORMATS.put("\"ALPHA_8\"", new ALPHA8_BitmapExtractor());
}
/**
* Maximum height or width of image beyond which we scale it on the device before retrieving.
*/
private static final int MAX_DIMENSION = 1024;
public static BufferedImage getBitmap(BitmapDataProvider dataProvider) {
String config = dataProvider.getBitmapConfigName();
if (config == null) {
throw new RuntimeException("Unable to determine bitmap configuration");
}
BitmapExtractor bitmapExtractor = SUPPORTED_FORMATS.get(config);
if (bitmapExtractor == null) {
throw new RuntimeException("Unsupported bitmap configuration: " + config);
}
Dimension size = dataProvider.getDimension();
if (size == null) {
throw new RuntimeException("Unable to determine image dimensions.");
}
// if the image is rather large, then scale it down
if (size.width > MAX_DIMENSION || size.height > MAX_DIMENSION) {
boolean couldDownsize = dataProvider.downsizeBitmap(size);
if (!couldDownsize) {
throw new RuntimeException("Unable to create scaled bitmap");
}View on GitHub (pinned to 3b8293bd65)