{"record":{"id":"4ad0466261d855ea","repo":"Tencent/matrix","slug":"unsupported-bitmap-configuration-config","errorCode":null,"errorMessage":"Unsupported bitmap configuration: <config>","messagePattern":"Unsupported bitmap configuration: <config>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-analyzer-cli/src/main/java/com/tencent/matrix/resource/analyzer/utils/BitmapDecoder.java","lineNumber":73,"sourceCode":"        SUPPORTED_FORMATS.put(\"\\\"RGB_565\\\"\", new RGB565_BitmapExtractor());\n        SUPPORTED_FORMATS.put(\"\\\"ALPHA_8\\\"\", new ALPHA8_BitmapExtractor());\n    }\n\n    /**\n     * Maximum height or width of image beyond which we scale it on the device before retrieving.\n     */\n    private static final int MAX_DIMENSION = 1024;\n\n\n    public static BufferedImage getBitmap(BitmapDataProvider dataProvider) {\n        String config = dataProvider.getBitmapConfigName();\n        if (config == null) {\n            throw new RuntimeException(\"Unable to determine bitmap configuration\");\n        }\n\n        BitmapExtractor bitmapExtractor = SUPPORTED_FORMATS.get(config);\n        if (bitmapExtractor == null) {\n            throw new RuntimeException(\"Unsupported bitmap configuration: \" + config);\n        }\n\n        Dimension size = dataProvider.getDimension();\n        if (size == null) {\n            throw new RuntimeException(\"Unable to determine image dimensions.\");\n        }\n\n        // if the image is rather large, then scale it down\n        if (size.width > MAX_DIMENSION || size.height > MAX_DIMENSION) {\n            boolean couldDownsize = dataProvider.downsizeBitmap(size);\n            if (!couldDownsize) {\n                throw new RuntimeException(\"Unable to create scaled bitmap\");\n            }\n\n            size = dataProvider.getDimension();\n            if (size == null) {\n                throw new RuntimeException(\"Unable to obtained scaled bitmap's dimensions\");\n            }","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-resource-canary/matrix-resource-canary-analyzer-cli/src/main/java/com/tencent/matrix/resource/analyzer/utils/BitmapDecoder.java#L55-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"HARDWARE bitmaps on API 26+ cannot be read from a heap dump; bitmaps from newer Android versions with configs the analyzer version predates.","solutions":["Add a BitmapExtractor for the reported config in BitmapDecoder.SUPPORTED_FORMATS","Re-capture the dump avoiding HARDWARE bitmaps (e.g. use software bitmaps in the analyzed code paths)","Upgrade the Matrix analyzer version to one supporting the newer bitmap config"],"exampleFix":"// before\n// no entry for HARDWARE in SUPPORTED_FORMATS\n// after\nSUPPORTED_FORMATS.put(\"HARDWARE\", new HardwareBitmapExtractor()); // decode via software fallback","handlingStrategy":"try-catch","validationCode":"String config = dataProvider.getBitmapConfigName();\nif (config != null && !SUPPORTED_FORMATS.containsKey(config)) { log.warn(\"unsupported config: \" + config); }","typeGuard":"boolean isSupportedConfig(BitmapDataProvider p) { String c = p.getBitmapConfigName(); return c != null && BitmapDecoder.SUPPORTED_FORMATS.containsKey(c); }","tryCatchPattern":"try { return BitmapDecoder.getBitmap(provider); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Unsupported bitmap configuration\")) { return null; } throw e; }","preventionTips":["Register extractors for all configs the app uses, including HARDWARE","Prefer software bitmap configs for data you may later analyze","Keep the analyzer updated for new Android bitmap configs"],"tags":["heap-dump","bitmap-decoding","unsupported-format"],"backgroundTag":"unsupported-enum-value","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}