Tencent/QMUI_Android · error · RuntimeException
Not support the type: %s
Error message
Not support the type: %s
What it means
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.
Source
Thrown at arch/src/main/java/com/qmuiteam/qmui/arch/record/DefaultLatestVisitStorage.java:177
if (arguments != null && arguments.size() > 0) {
for (String name : arguments.keySet()) {
RecordArgumentEditor.Argument argument = arguments.get(name);
if (argument != null) {
Class<?> type = argument.getType();
Object value = argument.getValue();
if (type == Integer.TYPE || type == Integer.class) {
editor.putInt(prefix + SP_INT_ARG_TAG + name, (Integer) value);
} else if (type == Boolean.TYPE || type == Boolean.class) {
editor.putBoolean(prefix + SP_BOOLEAN_ARG_TAG + name, (Boolean) value);
} else if (type == Float.TYPE || type == Float.class) {
editor.putFloat(prefix + SP_FLOAT_ARG_TAG + name, (Float) value);
} else if (type == Long.TYPE || type == Long.class) {
editor.putLong(prefix + SP_LONG_ARG_TAG + name, (Long) value);
} else if (type == String.class) {
editor.putString(prefix + SP_STRING_ARG_TAG + name, (String) value);
} else {
throw new RuntimeException(String.format(
"Not support the type: %s", type.getSimpleName()));
}
}
}
}
}
}
View on GitHub (pinned to 026e7d4866)
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.
Example fix
// before
bundleOf("user" to userObject) // passed to scheme -> RuntimeException
// after
bundleOf("userId" to userObject.id) // Long, supported by putLong Defensive patterns
Strategy: validation
Validate before calling
fun isSupportedSchemeArg(v: Any?) = v is Boolean || v is Int || v is Float || v is Long || v is String
// check every argument before invoking the scheme
require(args.all { isSupportedSchemeArg(it.value) }) { "unsupported scheme arg type: ${args.filterNot { isSupportedSchemeArg(it.value) }}" } Type guard
fun Any?.isStorableType(): Boolean = this is Boolean || this is Int || this is Float || this is Long || this is String
Try / catch
try {
QMUISchemeHandler.instance.handle(schemeUri, args)
} catch (e: RuntimeException) {
if (e.message?.startsWith("Not support the type") == true) {
Log.w(TAG, "dropping non-storable scheme args", e)
QMUISchemeHandler.instance.handle(schemeUri, args.filterValues { it.isStorableType() })
} else throw e
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- topView must implement from IQMUIContinuousNestedTopView
- bottomView must implement from IQMUIContinuousNestedBottomVi
- delegateView must be a instance of View
- start must >= 0 and < text.length
- end must > start
AI-assisted analysis of Tencent/QMUI_Android@026e7d4866 (2026-09-06).
Data as JSON: /api/errors/469c26ef7cbe5638.
Report an issue: GitHub.