Tencent/tinker · error · XmlPullParserException

bad mimeType

Error message

bad mimeType

What it means

While parsing <data> elements of an incremental component's intent-filter, IntentFilter.addDataType(mimeType) threw MalformedMimeTypeException, which Tinker rethrows as XmlPullParserException('bad mimeType'). The patched manifest declares a mimeType string the framework refuses (must be type/subtype with optional wildcards).

Source

Thrown at tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/hotplug/IncrementComponentManager.java:494

            final String tagName = parser.getName();
            if ("action".equals(tagName)) {
                final String name = parser.getAttributeValue(null, "name");
                if (name != null) {
                    intentFilter.addAction(name);
                }
            } else if ("category".equals(tagName)) {
                final String name = parser.getAttributeValue(null, "name");
                if (name != null) {
                    intentFilter.addCategory(name);
                }
            } else if ("data".equals(tagName)) {
                final String mimeType = parser.getAttributeValue(null, "mimeType");
                if (mimeType != null) {
                    try {
                        intentFilter.addDataType(mimeType);
                    } catch (IntentFilter.MalformedMimeTypeException e) {
                        throw new XmlPullParserException("bad mimeType", parser, e);
                    }
                }
                final String scheme = parser.getAttributeValue(null, "scheme");
                if (scheme != null) {
                    intentFilter.addDataScheme(scheme);
                }
                if (Build.VERSION.SDK_INT >= 19) {
                    final String ssp = parser.getAttributeValue(null, "ssp");
                    if (ssp != null) {
                        intentFilter.addDataSchemeSpecificPart(ssp, PatternMatcher.PATTERN_LITERAL);
                    }
                    final String sspPrefix = parser.getAttributeValue(null, "sspPrefix");
                    if (sspPrefix != null) {
                        intentFilter.addDataSchemeSpecificPart(sspPrefix, PatternMatcher.PATTERN_PREFIX);
                    }
                    final String sspPattern = parser.getAttributeValue(null, "sspPattern");
                    if (sspPattern != null) {
                        intentFilter.addDataSchemeSpecificPart(sspPattern, PatternMatcher.PATTERN_SIMPLE_GLOB);

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. Fix the mimeType in the source manifest to a valid 'type/subtype' (wildcards only as '*/*' or 'type/*').
  2. Rebuild and re-publish the patch after correcting the component manifest.

Example fix

<!-- before -->
<data android:mimeType="application"/>
<!-- after -->
<data android:mimeType="application/json"/>
Defensive patterns

Strategy: validation

Validate before calling

// Validate mimeTypes of increment components before publishing
private static boolean validMime(String m) {
    return m != null && m.matches("[\\w.+-]+/[\\w.+-]+");
}
for (String m : componentMimeTypes) if (!validMime(m)) failBuild();

Try / catch

try {
    intentFilter.addDataType(mimeType);
} catch (IntentFilter.MalformedMimeTypeException e) {
    // log with the offending value and reject the patch build
}

Prevention

When it happens

Trigger: A <data android:mimeType=...> value like 'text', '*/*extra', or containing spaces/invalid characters inside the incremental component manifest.

Common situations: Typos in the AndroidManifest of the dynamic/incremental component; copy-paste from docs producing malformed values; case/whitespace issues.

Related errors


AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14). Data as JSON: /api/errors/b963c60df30f6923. Report an issue: GitHub.