{"record":{"id":"edbf3a8fabbef9ee","repo":"Tencent/QMUI_Android","slug":"can-not-instance-the-class-schememapimpl-please-f","errorCode":null,"errorMessage":"Can not instance the Class SchemeMapImpl. Please file a issue to report this.","messagePattern":"Can not instance the Class SchemeMapImpl\\. Please file a issue to report this\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"arch/src/main/java/com/qmuiteam/qmui/arch/scheme/QMUISchemeHandler.kt","lineNumber":52,"sourceCode":"                val cls = Class.forName(SchemeMap::class.java.name + \"Impl\")\n                sSchemeMap = cls.newInstance() as SchemeMap\n            } catch (e: ClassNotFoundException) {\n                sSchemeMap = object : SchemeMap {\n                    override fun findScheme(handler: QMUISchemeHandler, schemeAction: String, params: Map<String, String>?): SchemeItem? {\n                        return null\n                    }\n\n                    override fun exists(handler: QMUISchemeHandler, schemeAction: String): Boolean {\n                        return false\n                    }\n                }\n            } catch (e: IllegalAccessException) {\n                throw RuntimeException(\n                    \"Can not access the Class SchemeMapImpl. \" +\n                            \"Please file a issue to report this.\"\n                )\n            } catch (e: InstantiationException) {\n                throw RuntimeException(\n                    \"Can not instance the Class SchemeMapImpl. \" +\n                            \"Please file a issue to report this.\"\n                )\n            }\n        }\n    }\n\n    val prefix: String = builder.prefix\n    private var interpolatorList: List<QMUISchemeHandlerInterceptor> = builder.interceptorList\n    private val blockSameSchemeTimeout = builder.blockSameSchemeTimeout\n    val defaultIntentFactory = builder.defaultIntentFactory\n    val defaultFragmentFactory = builder.defaultFragmentFactory\n    val defaultSchemeMatcher = builder.defaultSchemeMatcher\n    private val fallbackInterceptor = builder.fallbackInterceptor\n    private val unKnownSchemeHandler = builder.unKnownSchemeHandler\n    private var lastHandledScheme: List<String>? = null\n    private var lastSchemeHandledTime: Long = 0\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/arch/src/main/java/com/qmuiteam/qmui/arch/scheme/QMUISchemeHandler.kt#L34-L70","documentation":"Same reflective init as error 21, but this branch catches InstantiationException: the JVM could not create a new instance of the generated SchemeMapImpl — typically because the class is abstract, an interface, or has no accessible no-arg constructor. Wrapped in a RuntimeException telling you to file an issue.","triggerScenarios":"Accessing QMUISchemeHandler when SchemeMapImpl was generated as abstract/non-instantiable, the generated class is corrupted or manually replaced, or an old generated file without a public no-arg constructor lingers in the build.","commonSituations":"Stale generated sources after compiler/plugin upgrades; manually edited or hand-written SchemeMapImpl; build cache corruption; annotation processor version mismatch producing incompatible generated code.","solutions":["Clean the build (./gradlew clean) so SchemeMapImpl is regenerated fresh by SchemeProcessor.","Do not hand-edit or replace the generated SchemeMapImpl; re-run annotation processing and use the generated file as-is.","Verify arch and arch-compiler versions match (same release line).","If a fresh build still fails, inspect build/generated SchemeMapImpl for a public no-arg constructor and file an issue with the QMUI project."],"exampleFix":"// before\nclass SchemeMapImpl private constructor() : ISchemeMap { ... } // hand-edited\n\n// after\n// delete hand-written file, clean & rebuild so processor generates:\npublic class SchemeMapImpl implements ISchemeMap { public SchemeMapImpl() { ... } }","handlingStrategy":"try-catch","validationCode":"try {\n    val c = Class.forName(\"com.qmuiteam.qmui.arch.scheme.SchemeMapImpl\")\n    check(!c.isInterface && !java.lang.reflect.Modifier.isAbstract(c.modifiers)) { \"SchemeMapImpl not instantiable\" }\n    c.getDeclaredConstructor().newInstance()\n} catch (e: Throwable) {\n    Log.e(TAG, \"SchemeMapImpl cannot be instantiated — clean & rebuild\", e)\n}","typeGuard":"fun isSchemeMapInstantiable(): Boolean = runCatching {\n    val c = Class.forName(\"com.qmuiteam.qmui.arch.scheme.SchemeMapImpl\")\n    !c.isInterface && !java.lang.reflect.Modifier.isAbstract(c.modifiers)\n}.getOrDefault(false)","tryCatchPattern":"try {\n    QMUISchemeHandler.instance.handle(uri)\n} catch (e: RuntimeException) {\n    if (e.message?.contains(\"Can not instance the Class SchemeMapImpl\") == true) {\n        Log.e(TAG, \"regenerate SchemeMapImpl: clean build, remove hand-edits\", e)\n    } else throw e\n}","preventionTips":["Never hand-edit or replace generated SchemeMapImpl sources","Run ./gradlew clean after upgrading QMUI versions","Keep arch and arch-compiler versions in lockstep","Verify the generated class has a public no-arg constructor in CI build logs"],"tags":["android","reflection","instantiation","annotation-processing"],"backgroundTag":"class-not-found","analyzedSha":"026e7d486677d6593a96689cd590ec3561176717","analyzedAt":"2026-09-06T13:32:24.816Z","contentChangedAt":"2026-09-06T13:32:24.816Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}