Tencent/QMUI_Android · error · RuntimeException

Can not access the Class RecordMetaMapImpl. Please file a is

Error message

Can not access the Class RecordMetaMapImpl. Please file a issue to report this.

What it means

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.

Source

Thrown at arch/src/main/java/com/qmuiteam/qmui/arch/QMUILatestVisit.java:52

        mRecordArgumentEditor = new RecordArgumentEditorImpl();
        mNavRecordArgumentEditor = new RecordArgumentEditorImpl();
        try {
            Class<?> cls = Class.forName(RecordIdClassMap.class.getCanonicalName() + "Impl");
            mRecordMap = (RecordIdClassMap) cls.newInstance();
        } catch (ClassNotFoundException e) {
            mRecordMap = new RecordIdClassMap() {
                @Override
                public Class<?> getRecordClassById(int id) {
                    return null;
                }

                @Override
                public int getIdByRecordClass(Class<?> clazz) {
                    return QMUILatestVisitStorage.NOT_EXIST;
                }
            };
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Can not access the Class RecordMetaMapImpl. " +
                    "Please file a issue to report this.");
        } catch (InstantiationException e) {
            throw new RuntimeException("Can not instance the Class RecordMetaMapImpl. " +
                    "Please file a issue to report this.");
        }
    }

    @MainThread
    public static QMUILatestVisit getInstance(Context context) {
        if (sInstance == null) {
            sInstance = new QMUILatestVisit(context);
        }
        return sInstance;
    }

    public static Intent intentOfLatestVisit(Activity activity) {
        return getInstance(activity).getLatestVisitIntent(activity);
    }

View on GitHub (pinned to 026e7d4866)

Solutions

  1. Add ProGuard/R8 keep rules: -keep class com.qmuiteam.qmui.arch.** { *; } (or the library's bundled consumer rules) and rebuild the release build.
  2. Verify the error occurs only in minified builds; if so, inspect mapping.txt to confirm RecordMetaMapImpl was renamed and widen the keep rule.
  3. Update QMUI Android to the latest version where the reflective init may be replaced by direct instantiation.
  4. If it persists in debug builds, file the issue with the QMUI project as the message requests, including device/OS details.

Example fix

// before (proguard-rules.pro)
# no qmui rules
// after
-keep class com.qmuiteam.qmui.arch.** { *; }
-dontwarn com.qmuiteam.qmui.**
Defensive patterns

Strategy: try-catch

Validate before calling

// release build check before touching QMUILatestVisit
boolean minified = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0;

Try / catch

try {
    QMUILatestVisit.getInstance(context);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("RecordMetaMapImpl")) {
        Log.e(TAG, "Qmui reflective init failed; check proguard rules", e);
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Tencent/QMUI_Android@026e7d4866 (2026-09-06). Data as JSON: /api/errors/d25caacb7a7363b2. Report an issue: GitHub.