Tencent/tinker · error · IllegalStateException
unexpected xml parser state when parsing incremental compone
Error message
unexpected xml parser state when parsing incremental component manifest.
What it means
When translating the incremental component manifest, the ActivityInfo AttrTranslator asserts the XmlPullParser is positioned on a START_TAG named 'activity' whenever it sees TAG_ACTIVITY. This IllegalStateException means the parser's event/position contradicted the tag type being processed — the manifest stream does not have the expected structure.
Source
Thrown at tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/hotplug/IncrementComponentManager.java:83
}
}
void onInit(Context context, int tagType, XmlPullParser parser) {
// Do nothing.
}
abstract void onTranslate(Context context, int tagType, String attrName, String attrValue, T_RESULT result);
}
private static final AttrTranslator<ActivityInfo> ACTIVITY_INFO_ATTR_TRANSLATOR = new AttrTranslator<ActivityInfo>() {
@Override
void onInit(Context context, int tagType, XmlPullParser parser) {
try {
if (tagType == TAG_ACTIVITY
&& (parser.getEventType() != XmlPullParser.START_TAG
|| !"activity".equals(parser.getName()))) {
throw new IllegalStateException("unexpected xml parser state when parsing incremental component manifest.");
}
} catch (XmlPullParserException e) {
throw new IllegalStateException(e);
}
}
@Override
void onTranslate(Context context, int tagType, String attrName, String attrValue, ActivityInfo result) {
if ("name".equals(attrName)) {
if (attrValue.charAt(0) == '.') {
result.name = context.getPackageName() + attrValue;
} else {
result.name = attrValue;
}
} else if ("parentActivityName".equals(attrName)) {
if (Build.VERSION.SDK_INT >= 16) {
if (attrValue.charAt(0) == '.') {
result.parentActivityName = context.getPackageName() + attrValue;View on GitHub (pinned to 1b7ea02c23)
Solutions
- Rebuild the patch with the Tinker gradle plugin version exactly matching the SDK in the app.
- Do not hand-modify patch contents; repackage through the official build flow.
- If recurring, catch the exception during patch load and reject/disable the patch server-side.
Defensive patterns
Strategy: validation
Validate before calling
// Before shipping patch: validate the component manifest parses // XmlPullParser over patch dex/component manifest in a unit test // using the same SDK version as the app
Try / catch
try {
IncrementComponentManager.commitInstalled(...);
} catch (IllegalStateException e) {
// malformed incremental manifest: reject this patch, keep previous
} Prevention
- Use matching gradle-plugin/SDK versions to generate and consume patches.
- Automate a patch-validation step in CI (parse component manifest with the loader's parser).
- Never hand-edit files inside the built patch package.
When it happens
Trigger: Malformed component manifest inside the patch (dex/metadata), or a manifest generated by a patch tool whose element ordering/structure differs from what this parser expects (tool/loader version mismatch).
Common situations: Patch built with an old/new Tinker gradle plugin loaded by a mismatched SDK; hand-edited or truncated component manifest files in the patch package.
Related errors
- failed to fetch instance of ActivityThread.
- bad mimeType
- Not initialized!!
- fakeBinder does not return fakeInterface, binder: {}, itf: {
- cannot find class: {}
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/7ec1f7e57682e397.
Report an issue: GitHub.