{"record":{"id":"118bc493d56096e6","repo":"PhilJay/MPAndroidChart","slug":"fill-drawables-not-yet-supported-below-api-level","errorCode":null,"errorMessage":"Fill-drawables not (yet) supported below API level 18, this code was run on API level {Utils.getSDKInt()}.","messagePattern":"Fill-drawables not \\(yet\\) supported below API level 18, this code was run on API level (.+?)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineRadarRenderer.java","lineNumber":43,"sourceCode":"     * @param filledPath\n     * @param drawable\n     */\n    protected void drawFilledPath(Canvas c, Path filledPath, Drawable drawable) {\n\n        if (clipPathSupported()) {\n\n            int save = c.save();\n            c.clipPath(filledPath);\n\n            drawable.setBounds((int) mViewPortHandler.contentLeft(),\n                    (int) mViewPortHandler.contentTop(),\n                    (int) mViewPortHandler.contentRight(),\n                    (int) mViewPortHandler.contentBottom());\n            drawable.draw(c);\n\n            c.restoreToCount(save);\n        } else {\n            throw new RuntimeException(\"Fill-drawables not (yet) supported below API level 18, \" +\n                    \"this code was run on API level \" + Utils.getSDKInt() + \".\");\n        }\n    }\n\n    /**\n     * Draws the provided path in filled mode with the provided color and alpha.\n     * Special thanks to Angelo Suzuki (https://github.com/tinsukE) for this.\n     *\n     * @param c\n     * @param filledPath\n     * @param fillColor\n     * @param fillAlpha\n     */\n    protected void drawFilledPath(Canvas c, Path filledPath, int fillColor, int fillAlpha) {\n\n        int color = (fillAlpha << 24) | (fillColor & 0xffffff);\n\n        if (clipPathSupported()) {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/PhilJay/MPAndroidChart/blob/9c7275a0596a7ac0e50ca566e680f7f9d73607af/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineRadarRenderer.java#L25-L61","documentation":"Thrown by LineRadarRenderer when a Fill is configured to use a Drawable but the runtime API level is below 18 (Android 4.3). Clip-path + drawable drawing relies on Canvas.clipPath hardware acceleration behavior that is unreliable before API 18, so the renderer refuses to draw rather than render incorrectly. The actual SDK level is interpolated into the message.","triggerScenarios":"Setting a line/radar Fill with setFillDrawable(...) or Fill.setType(Fill.Type.DRAWABLE) and running the app on a device/emulator below Android 4.3 (API 17 or lower). Running instrumentation tests on a low-API emulator.","commonSituations":"Shipping to legacy devices; minSdkVersion < 18 while using drawable fills; CI matrix that includes older emulator images; using gradient/bitmap drawables for area fills without gating on API level.","solutions":["Raise minSdkVersion to 18 (or higher) if your device matrix allows it.","Gate drawable fills at runtime: if (Utils.getSDKInt() >= 18) set.setFillDrawable(d); else use a solid color Fill.","Use Fill.Type.COLOR (solid color) or a gradient shader instead of a Drawable for pre-18 devices.","Filter the feature in build flavors so legacy builds never configure drawable fills."],"exampleFix":"// before\nFill fill = new Fill(d -> drawable);\nlineDataSet.setFill(drawableFill); // crashes below API 18\n\n// after\nFill fill;\nif (Utils.getSDKInt() >= 18) {\n    fill = new Fill(myDrawable);\n} else {\n    fill = new Fill(Color.parseColor(\"#33000000\"));\n}\nlineDataSet.setFill(fill);","handlingStrategy":"validation","validationCode":"if (Utils.getSDKInt() >= 18) {\n    lineDataSet.setFillDrawable(myDrawable);\n} else {\n    lineDataSet.setFillColor(fallbackColor);\n}","typeGuard":"boolean supportsDrawableFill() {\n    return Utils.getSDKInt() >= 18;\n}","tryCatchPattern":null,"preventionTips":["Gate drawable fills behind an API-level check.","Keep a solid-color Fill fallback for legacy devices.","Set minSdkVersion appropriately or exclude drawable fills via build flavors."],"tags":["renderer","fill","drawable","api-level","compatibility"],"backgroundTag":null,"analyzedSha":"9c7275a0596a7ac0e50ca566e680f7f9d73607af","analyzedAt":"2026-08-14T00:17:56.136Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}