{"record":{"id":"d25caacb7a7363b2","repo":"Tencent/QMUI_Android","slug":"can-not-access-the-class-recordmetamapimpl-please","errorCode":null,"errorMessage":"Can not access the Class RecordMetaMapImpl. Please file a issue to report this.","messagePattern":"Can not access the Class RecordMetaMapImpl\\. Please file a issue to report this\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"arch/src/main/java/com/qmuiteam/qmui/arch/QMUILatestVisit.java","lineNumber":52,"sourceCode":"        mRecordArgumentEditor = new RecordArgumentEditorImpl();\n        mNavRecordArgumentEditor = new RecordArgumentEditorImpl();\n        try {\n            Class<?> cls = Class.forName(RecordIdClassMap.class.getCanonicalName() + \"Impl\");\n            mRecordMap = (RecordIdClassMap) cls.newInstance();\n        } catch (ClassNotFoundException e) {\n            mRecordMap = new RecordIdClassMap() {\n                @Override\n                public Class<?> getRecordClassById(int id) {\n                    return null;\n                }\n\n                @Override\n                public int getIdByRecordClass(Class<?> clazz) {\n                    return QMUILatestVisitStorage.NOT_EXIST;\n                }\n            };\n        } catch (IllegalAccessException e) {\n            throw new RuntimeException(\"Can not access the Class RecordMetaMapImpl. \" +\n                    \"Please file a issue to report this.\");\n        } catch (InstantiationException e) {\n            throw new RuntimeException(\"Can not instance the Class RecordMetaMapImpl. \" +\n                    \"Please file a issue to report this.\");\n        }\n    }\n\n    @MainThread\n    public static QMUILatestVisit getInstance(Context context) {\n        if (sInstance == null) {\n            sInstance = new QMUILatestVisit(context);\n        }\n        return sInstance;\n    }\n\n    public static Intent intentOfLatestVisit(Activity activity) {\n        return getInstance(activity).getLatestVisitIntent(activity);\n    }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/arch/src/main/java/com/qmuiteam/qmui/arch/QMUILatestVisit.java#L34-L70","documentation":"QMUILatestVisit's static initializer reflectively instantiates the internal RecordMetaMapImpl class. If Class.newInstance() (or the reflective access) raises IllegalAccessException, the library wraps it in a RuntimeException instructing the developer to file an issue, because this internal class should always be accessible within the library's own dex/jar — failure signals a broken build, R8/ProGuard stripping, or classloader problem.","triggerScenarios":"First call that triggers QMUILatestVisit's class initialization when the RecordMetaMapImpl class cannot be reflectively accessed — typically because R8/ProGuard renamed/removed it without a keep rule, or a broken multidex/classloader environment.","commonSituations":"Release builds with aggressive minification and no -keep rules for com.qmuiteam.qmui.arch.**, customized build tooling stripping internal classes, or classloader isolation issues on some OEM Android versions.","solutions":["Add ProGuard/R8 keep rules: -keep class com.qmuiteam.qmui.arch.** { *; } (or the library's bundled consumer rules) and rebuild the release build.","Verify the error occurs only in minified builds; if so, inspect mapping.txt to confirm RecordMetaMapImpl was renamed and widen the keep rule.","Update QMUI Android to the latest version where the reflective init may be replaced by direct instantiation.","If it persists in debug builds, file the issue with the QMUI project as the message requests, including device/OS details."],"exampleFix":"// before (proguard-rules.pro)\n# no qmui rules\n// after\n-keep class com.qmuiteam.qmui.arch.** { *; }\n-dontwarn com.qmuiteam.qmui.**","handlingStrategy":"try-catch","validationCode":"// release build check before touching QMUILatestVisit\nboolean minified = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0;","typeGuard":null,"tryCatchPattern":"try {\n    QMUILatestVisit.getInstance(context);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"RecordMetaMapImpl\")) {\n        Log.e(TAG, \"Qmui reflective init failed; check proguard rules\", e);\n    } else throw e;\n}","preventionTips":["Keep com.qmuiteam.qmui.arch.** classes in ProGuard/R8 rules","Test minified release builds before shipping","Keep the QMUI dependency current"],"tags":["android","reflection","proguard","initialization"],"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"}