{"record":{"id":"469c26ef7cbe5638","repo":"Tencent/QMUI_Android","slug":"not-support-the-type-s","errorCode":null,"errorMessage":"Not support the type: %s","messagePattern":"Not support the type: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"arch/src/main/java/com/qmuiteam/qmui/arch/record/DefaultLatestVisitStorage.java","lineNumber":177,"sourceCode":"\n        if (arguments != null && arguments.size() > 0) {\n            for (String name : arguments.keySet()) {\n                RecordArgumentEditor.Argument argument = arguments.get(name);\n                if (argument != null) {\n                    Class<?> type = argument.getType();\n                    Object value = argument.getValue();\n                    if (type == Integer.TYPE || type == Integer.class) {\n                        editor.putInt(prefix + SP_INT_ARG_TAG + name, (Integer) value);\n                    } else if (type == Boolean.TYPE || type == Boolean.class) {\n                        editor.putBoolean(prefix + SP_BOOLEAN_ARG_TAG + name, (Boolean) value);\n                    } else if (type == Float.TYPE || type == Float.class) {\n                        editor.putFloat(prefix + SP_FLOAT_ARG_TAG + name, (Float) value);\n                    } else if (type == Long.TYPE || type == Long.class) {\n                        editor.putLong(prefix + SP_LONG_ARG_TAG + name, (Long) value);\n                    } else if (type == String.class) {\n                        editor.putString(prefix + SP_STRING_ARG_TAG + name, (String) value);\n                    } else {\n                        throw new RuntimeException(String.format(\n                                \"Not support the type: %s\", type.getSimpleName()));\n                    }\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":159,"sourceCodeEnd":185,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/arch/src/main/java/com/qmuiteam/qmui/arch/record/DefaultLatestVisitStorage.java#L159-L185","documentation":"DefaultLatestVisitStorage.putArguments persists fragment/activity launch arguments into SharedPreferences. It only handles Boolean, Int, Float, Long and String values; any argument of another type (e.g. Double, Parcelable, Bundle, Serializable) hits the else branch and throws this RuntimeException. The library intentionally fails fast rather than silently dropping the argument.","triggerScenarios":"Navigating to a @SchemeFragment/@SchemeActivity-annotated page (via QMUISchemeHandler or QMUINavigation) while passing an argument whose type is not one of the supported SP types. putArguments is invoked from saveFragmentRecordInfo / saveActivityRecordInfo during record saving.","commonSituations":"Passing custom model objects, Double, arrays, or Bundle extras as scheme arguments; refactoring an argument from String to a POJO after the scheme was recorded; library upgrade changed the supported-type list and old saved records now contain unsupported types.","solutions":["Change the argument to a supported type: Boolean, Int, Float, Long, or String (encode complex values as String, e.g. JSON).","Remove the unsupported argument from the scheme call if it is not needed for latest-visit restoration.","Fork/override the storage: subclass or replace DefaultLatestVisitStorage with an implementation that serializes extra types yourself.","If the throw happens while reading old records, clear the app's SharedPreferences used by the arch module and re-save records."],"exampleFix":"// before\nbundleOf(\"user\" to userObject) // passed to scheme -> RuntimeException\n\n// after\nbundleOf(\"userId\" to userObject.id) // Long, supported by putLong","handlingStrategy":"validation","validationCode":"fun isSupportedSchemeArg(v: Any?) = v is Boolean || v is Int || v is Float || v is Long || v is String\n// check every argument before invoking the scheme\nrequire(args.all { isSupportedSchemeArg(it.value) }) { \"unsupported scheme arg type: ${args.filterNot { isSupportedSchemeArg(it.value) }}\" }","typeGuard":"fun Any?.isStorableType(): Boolean = this is Boolean || this is Int || this is Float || this is Long || this is String","tryCatchPattern":"try {\n    QMUISchemeHandler.instance.handle(schemeUri, args)\n} catch (e: RuntimeException) {\n    if (e.message?.startsWith(\"Not support the type\") == true) {\n        Log.w(TAG, \"dropping non-storable scheme args\", e)\n        QMUISchemeHandler.instance.handle(schemeUri, args.filterValues { it.isStorableType() })\n    } else throw e\n}","preventionTips":["Restrict scheme arguments to Boolean/Int/Float/Long/String by convention","Serialize complex models to JSON strings before passing","Add a unit test asserting all scheme payloads used in the app pass isStorableType","Review scheme argument types whenever refactoring page-parameter models"],"tags":["android","sharedpreferences","unsupported-type","qmui"],"backgroundTag":"unsupported-operation","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"}