{"record":{"id":"fc5f1c035552cfe5","repo":"Blankj/AndroidUtilCode","slug":"busextension-s-busutilsclass-is-empty","errorCode":null,"errorMessage":"BusExtension's busUtilsClass is empty.","messagePattern":"BusExtension's busUtilsClass is empty\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugin/bus-gradle-plugin/src/main/java/com/blankj/bus/BusPlugin.groovy","lineNumber":29,"sourceCode":"import java.util.regex.Pattern\n\nclass BusPlugin extends BaseTransformPlugin<BusExtension> {\n\n    String busUtilsClass\n    File jsonFile\n    Map<String, List<BusInfo>> busMap = [:]\n    File busUtilsTransformFile\n\n    @Override\n    String getPluginName() {\n        return Config.EXT_NAME\n    }\n\n    @Override\n    void onScanStarted() {\n        busUtilsClass = ext.busUtilsClass\n        if (busUtilsClass.trim().equals(\"\")) {\n            throw new Exception(\"BusExtension's busUtilsClass is empty.\")\n        }\n\n        jsonFile = new File(mProject.projectDir.getAbsolutePath(), \"__bus__.json\")\n        FileUtils.write(jsonFile, \"{}\")\n    }\n\n    @Override\n    boolean isIgnoreScan(JarInput input) {\n        def jarName = input.name\n        if (jarName.contains(\"utilcode\")) {\n            return false\n        }\n\n        if (ext.onlyScanLibRegex != null && ext.onlyScanLibRegex.trim().length() > 0) {\n            return !Pattern.matches(ext.onlyScanLibRegex, jarName)\n        }\n\n        if (ext.jumpScanLibRegex != null && ext.jumpScanLibRegex.trim().length() > 0) {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/Blankj/AndroidUtilCode/blob/7b4caf9e5440046b3fefb63b6b6e2ead7ebaf809/plugin/bus-gradle-plugin/src/main/java/com/blankj/bus/BusPlugin.groovy#L11-L47","documentation":"BusPlugin.onScanStarted() reads ext.busUtilsClass (BusExtension default \"com.blankj.utilcode.util.BusUtils\"). If, after trim(), the value is empty, it throws Exception. The plugin needs the BusUtils FQN to know which class to inject the event registry into during transform.","triggerScenarios":"Configuring the bus{} DSL with busUtilsClass set to an empty string or whitespace, e.g. bus { busUtilsClass \"\" }; or assigning a property that resolves to a blank value.","commonSituations":"Pointing the bus extension at a custom BusUtils class but leaving the path blank; a typo or cleared property; copy-pasting a config snippet that omitted the value.","solutions":["Set busUtilsClass to the fully-qualified name of your BusUtils class, e.g. bus { busUtilsClass 'com.blankj.utilcode.util.BusUtils' }.","If you use AndroidUtilCode's built-in BusUtils, remove the busUtilsClass override so the default applies.","Make sure no build logic assigns an empty/whitespace string to ext.busUtilsClass."],"exampleFix":"// before\nbus {\n    busUtilsClass \"   \"   // -> \"BusExtension's busUtilsClass is empty.\"\n}\n\n// after\nbus {\n    busUtilsClass \"com.blankj.utilcode.util.BusUtils\"\n}\n// or omit the bus{} block entirely to use the default","handlingStrategy":"validation","validationCode":"afterEvaluate {\n    def extBus = project.extensions.findByName('bus')\n    if (extBus == null || !extBus.busUtilsClass?.trim()) {\n        throw new GradleException(\"bus { busUtilsClass '...' } must be set and non-blank.\")\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a concrete fully-qualified class name to busUtilsClass, never blank.","If unsure, omit the bus{} block and rely on the default com.blankj.utilcode.util.BusUtils.","Add an afterEvaluate assertion so a blank value fails your build early with a clear message."],"tags":["gradle-plugin","bus","config","build"],"backgroundTag":null,"analyzedSha":"7b4caf9e5440046b3fefb63b6b6e2ead7ebaf809","analyzedAt":"2026-08-14T02:26:54.956Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}