{"record":{"id":"7e3316c5d1a52968","repo":"Tencent/QMUI_Android","slug":"can-not-access-the-class-schememapimpl-please-fil","errorCode":null,"errorMessage":"Can not access the Class SchemeMapImpl. Please file a issue to report this.","messagePattern":"Can not access 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":47,"sourceCode":"        const val ARG_FINISH_CURRENT = \"__qmui_finish_current\"\n        private var sSchemeMap: SchemeMap? = null\n\n        init {\n            try {\n                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","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/arch/src/main/java/com/qmuiteam/qmui/arch/scheme/QMUISchemeHandler.kt#L29-L65","documentation":"QMUISchemeHandler's companion init reflectively instantiates the generated class SchemeMapImpl (produced by the arch-compiler SchemeProcessor). If Class.newInstance() raises IllegalAccessException — e.g. the class or its constructor is not accessible from the caller's classloader — the library wraps it in this RuntimeException and asks you to file an issue.","triggerScenarios":"First access to QMUISchemeHandler (its public init/companion) when annotation processing failed to generate SchemeMapImpl correctly, or the generated class/constructor is not public, or R8/ProGuard stripped or renamed SchemeMapImpl so reflection cannot access it.","commonSituations":"ProGuard/R8 keep-rule missing for com.qmuiteam.qmui.arch.scheme.SchemeMapImpl in a minified release build; annotation processor not applied so a stale/inaccessible generated class exists; multi-dex/classloader edge cases.","solutions":["Add keep rules for the generated class: -keep class **.SchemeMapImpl { public <init>(); } (or keep com.qmuiteam.qmui.arch.scheme.**).","Verify kapt/annotationProcessor (arch-compiler) is configured so SchemeMapImpl is actually generated at compile time.","Check the generated SchemeMapImpl source (build/generated) and ensure the class and constructor are public.","If the class exists, is public, and keep rules are present, report the issue to the QMUI Android repository as the message suggests."],"exampleFix":"// before (proguard-rules.pro)\n# no rule -> SchemeMapImpl stripped\n\n// after\n-keep class com.qmuiteam.qmui.arch.scheme.SchemeMapImpl { *; }","handlingStrategy":"try-catch","validationCode":"try {\n    Class.forName(\"com.qmuiteam.qmui.arch.scheme.SchemeMapImpl\")\n} catch (e: Throwable) {\n    Log.e(TAG, \"SchemeMapImpl missing/inaccessible — check kapt + proguard rules\", e)\n}","typeGuard":"fun isSchemeMapAvailable(): Boolean = runCatching {\n    Class.forName(\"com.qmuiteam.qmui.arch.scheme.SchemeMapImpl\").constructors.any { it.parameterTypes.isEmpty() }\n}.getOrDefault(false)","tryCatchPattern":"val intent = try {\n    QMUISchemeHandler.instance.handle(uri)\n} catch (e: RuntimeException) {\n    if (e.message?.contains(\"Can not access the Class SchemeMapImpl\") == true) {\n        Log.e(TAG, \"scheme init failed: keep rules / kapt missing\", e)\n        null\n    } else throw e\n}","preventionTips":["Add -keep rules for SchemeMapImpl and com.qmuiteam.qmui.arch.scheme.** in release builds","Always apply arch-compiler via kapt/annotationProcessor in modules using @Scheme* annotations","Smoke-test scheme handling in a minified release build, not only debug","Keep arch and arch-compiler on the same version"],"tags":["android","reflection","proguard","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-14T00:17:10.932Z"}