Tencent/tinker · error · IllegalStateException
Not initialized!!
Error message
Not initialized!!
What it means
IncrementComponentManager keeps incremental component metadata in static maps populated only by commitInstalled(). Query APIs (isIncrementActivity, queryActivityInfo, etc.) call ensureInitialized(), which throws IllegalStateException('Not initialized!!') when a query happens before any successful install/commit in this process.
Source
Thrown at tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/hotplug/IncrementComponentManager.java:563
if (aInfo.metaData == null) {
aInfo.metaData = new Bundle(myCl);
}
aInfo.metaData.putString(name, value);
}
}
private static void skipCurrentTag(XmlPullParser parser) throws IOException, XmlPullParserException {
int outerDepth = parser.getDepth();
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& (type != XmlPullParser.END_TAG
|| parser.getDepth() > outerDepth)) {
}
}
private static synchronized void ensureInitialized() {
if (!sInitialized) {
throw new IllegalStateException("Not initialized!!");
}
}
public static boolean isIncrementActivity(String className) {
ensureInitialized();
return className != null && CLASS_NAME_TO_ACTIVITY_INFO_MAP.containsKey(className);
}
public static ActivityInfo queryActivityInfo(String className) {
ensureInitialized();
return (className != null ? CLASS_NAME_TO_ACTIVITY_INFO_MAP.get(className) : null);
}
// TODO needs to support rest type of components.
public static ResolveInfo resolveIntent(Intent intent) {
ensureInitialized();
int maxPriority = -1;View on GitHub (pinned to 1b7ea02c23)
Solutions
- Ensure ComponentHotplug.install(...) and the component metadata commit complete during Application attachBaseContext, before any component can be started.
- Guard query call sites with an initialized check (or try-catch) and treat un-initialized as 'not incremental'.
- Do not query IncrementComponentManager from processes that don't run the Tinker hotplug install.
Example fix
// before
ActivityInfo ai = IncrementComponentManager.queryActivityInfo(cls);
// after
if (IncrementComponentManager.isIncrementActivityEnabledCompat()) { /* only after install */ }
ActivityInfo ai = IncrementComponentManager.queryActivityInfo(cls); Defensive patterns
Strategy: validation
Validate before calling
// Track initialization yourself before querying
if (hotplugInstallCompleted) {
ActivityInfo ai = IncrementComponentManager.queryActivityInfo(cls);
} Try / catch
try {
return IncrementComponentManager.queryActivityInfo(cls);
} catch (IllegalStateException e) {
return null; // not initialized => treat as non-incremental component
} Prevention
- Complete ComponentHotplug.install and commitInstalled during attachBaseContext before any component launch.
- Don't call IncrementComponentManager from processes that skip hotplug install.
- Treat 'Not initialized!!' as a normal cold-state condition, not a crash.
When it happens
Trigger: Calling IncrementComponentManager.queryActivityInfo/isIncrementActivity before ComponentHotplug.install(...) + commitInstalled(...) ran — e.g. interception code executing before patch loading finished, or in a process where hotplug install was skipped.
Common situations: Racing ActivityThread.mH interception: the hook receives a launch message before the patch metadata is committed; queries from other processes that never ran install.
Related errors
- you must install tinker before get tinker sInstance
- Tinker instance is already set.
- upgradePatchProcessor is null.
- you must install tinker before get tinker sInstance
- Tinker instance is already set.
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/d6ad7549764c54d0.
Report an issue: GitHub.