Tencent/matrix · error · RuntimeException

Unsupported bitmap configuration

Error message

Unsupported bitmap configuration: <config>

What it means

After reading the bitmap config name, BitmapDecoder looks it up in SUPPORTED_FORMATS; configs with no registered BitmapExtractor (anything outside the known Bitmap.Config set like ALPHA_8/RGB_565/ARGB_4444/ARGB_8888) throw this RuntimeException with the config name in the message.

Solutions

  1. Add a BitmapExtractor for the reported config in BitmapDecoder.SUPPORTED_FORMATS
  2. Re-capture the dump avoiding HARDWARE bitmaps (e.g. use software bitmaps in the analyzed code paths)
  3. Upgrade the Matrix analyzer version to one supporting the newer bitmap config

Example fix

// before
// no entry for HARDWARE in SUPPORTED_FORMATS
// after
SUPPORTED_FORMATS.put("HARDWARE", new HardwareBitmapExtractor()); // decode via software fallback
Defensive patterns

Strategy: try-catch

Validate before calling

String config = dataProvider.getBitmapConfigName();
if (config != null && !SUPPORTED_FORMATS.containsKey(config)) { log.warn("unsupported config: " + config); }

Type guard

boolean isSupportedConfig(BitmapDataProvider p) { String c = p.getBitmapConfigName(); return c != null && BitmapDecoder.SUPPORTED_FORMATS.containsKey(c); }

Try / catch

try { return BitmapDecoder.getBitmap(provider); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unsupported bitmap configuration")) { return null; } throw e; }

Prevention

When it happens

Trigger: The heap dump reports a bitmap config name that is not in SUPPORTED_FORMATS, e.g. HARDWARE config bitmaps or vendor-specific/unknown config strings.

Common situations: HARDWARE bitmaps on API 26+ cannot be read from a heap dump; bitmaps from newer Android versions with configs the analyzer version predates.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/4ad0466261d855ea. 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:73

        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");
            }

            size = dataProvider.getDimension();
            if (size == null) {
                throw new RuntimeException("Unable to obtained scaled bitmap's dimensions");
            }

View on GitHub (pinned to 3b8293bd65)