{"record":{"id":"ae44399420a6a696","repo":"PhilJay/MPAndroidChart","slug":"fill-drawables-not-yet-supported-below-api-level-ae4439","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/utils/Fill.java","lineNumber":338,"sourceCode":"                        clipRect == null ? c.getHeight() : (int) clipRect.bottom);\n                mDrawable.draw(c);\n\n                c.restoreToCount(save);\n            }\n            break;\n        }\n    }\n\n    private boolean isClipPathSupported()\n    {\n        return Utils.getSDKInt() >= 18;\n    }\n\n    private void ensureClipPathSupported()\n    {\n        if (Utils.getSDKInt() < 18)\n        {\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","sourceCodeStart":320,"sourceCodeEnd":343,"githubUrl":"https://github.com/PhilJay/MPAndroidChart/blob/9c7275a0596a7ac0e50ca566e680f7f9d73607af/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Fill.java#L320-L343","documentation":"Thrown by Fill.ensureClipPathSupported() when a Drawable-based fill is requested on API < 18. It is the same guard as LineRadarRenderer's, centralized in the Fill utility: isClipPathSupported() returns Utils.getSDKInt() >= 18 and ensureClipPathSupported() throws if not. The DRAWABLE branch of Fill performs a Canvas.clipPath which needs the modern canvas behavior.","triggerScenarios":"Configuring a Fill with Type.DRAWABLE or a Drawable and rendering on a device/emulator below API 18. Calling fill.fillPath(...) on a low-API runtime when mDrawable != null.","commonSituations":"Supporting old Android versions; using bitmap/gradient drawables for chart area fills; emulator-based testing on older images; library consumers unaware of the API-18 requirement.","solutions":["Use a color-based Fill on API < 18 and reserve Drawable fills for API >= 18.","Raise the app's minSdkVersion to 18 if drawable fills are required everywhere.","Check fill.isClipPathSupported() (or Utils.getSDKInt() >= 18) before assigning a Drawable fill.","Provide a fallback color in your chart-styling code for legacy devices."],"exampleFix":"// before\nFill fill = new Fill(myDrawable);\nfill.fillPath(path, paint, canvas); // throws on API < 18\n\n// after\nFill fill = (Utils.getSDKInt() >= 18)\n    ? new Fill(myDrawable)\n    : new Fill(Color.argb(80, 0, 0, 0));\nfill.fillPath(path, paint, canvas);","handlingStrategy":"validation","validationCode":"if (Utils.getSDKInt() >= 18) {\n    fill = new Fill(myDrawable);\n} else {\n    fill = new Fill(Color.argb(80, 0, 0, 0));\n}","typeGuard":"boolean supportsClipPath() {\n    return Utils.getSDKInt() >= 18;\n}","tryCatchPattern":null,"preventionTips":["Use color or shader fills on API < 18.","Centralize API-level gating in your chart-styling layer.","Test fills across the lowest API in your support matrix."],"tags":["fill","drawable","api-level","compatibility","clip-path"],"backgroundTag":null,"analyzedSha":"9c7275a0596a7ac0e50ca566e680f7f9d73607af","analyzedAt":"2026-08-14T00:17:56.136Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}