Tencent/tinker · error · TinkerRuntimeException
loadReporter must not be null.
Error message
loadReporter must not be null.
What it means
Tinker.Builder.loadReport(LoadReporter) throws TinkerRuntimeException("loadReporter must not be null.") when passed a null LoadReporter. The load reporter receives patch-load callbacks (load success/failure, patch applied, etc.) and is a required part of a Tinker configuration — the builder rejects null rather than defaulting, because missing load-failure reporting would hide broken patches.
Source
Thrown at tinker-android/tinker-android-lib-no-op/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java:335
}
this.status = tinkerFlags;
return this;
}
public Builder tinkerLoadVerifyFlag(Boolean verifyMd5WhenLoad) {
if (verifyMd5WhenLoad == null) {
throw new TinkerRuntimeException("tinkerLoadVerifyFlag must not be null.");
}
if (this.tinkerLoadVerifyFlag != null) {
throw new TinkerRuntimeException("tinkerLoadVerifyFlag is already set.");
}
this.tinkerLoadVerifyFlag = verifyMd5WhenLoad;
return this;
}
public Builder loadReport(LoadReporter loadReporter) {
if (loadReporter == null) {
throw new TinkerRuntimeException("loadReporter must not be null.");
}
if (this.loadReporter != null) {
throw new TinkerRuntimeException("loadReporter is already set.");
}
this.loadReporter = loadReporter;
return this;
}
public Builder patchReporter(PatchReporter patchReporter) {
if (patchReporter == null) {
throw new TinkerRuntimeException("patchReporter must not be null.");
}
if (this.patchReporter != null) {
throw new TinkerRuntimeException("patchReporter is already set.");
}
this.patchReporter = patchReporter;
return this;
}View on GitHub (pinned to 1b7ea02c23)
Solutions
- Construct the LoadReporter first (e.g. new DefaultLoadReporter(application)) into a local variable and pass it; verify non-null before the chain.
- Initialize fields in attachBaseContext before the builder chain, or build the chain inside onCreate where the application is ready.
- In tests, provide a no-op LoadReporter subclass instead of null.
Example fix
// before builder.loadReport(loadReporter); // field still null at this point // after LoadReporter loadReporter = new DefaultLoadReporter(getApplicationContext()); builder.loadReport(loadReporter);
Defensive patterns
Strategy: validation
Validate before calling
LoadReporter loadReporter = (customReporter != null)
? customReporter
: new DefaultLoadReporter(getApplicationContext());
builder.loadReport(loadReporter); Prevention
- Create reporters into local variables and null-check before the chain
- Initialize Tinker only after the Application context is available
When it happens
Trigger: Calling loadReport(null) — commonly a reporter field that failed to initialize, a constructor ordering issue where the reporter is created after the builder chain runs, or a refactor where the argument was dropped.
Common situations: Custom Application classes initializing Tinker in attachBaseContext while the DefaultLoadReporter (which needs the application) is constructed from a not-yet-ready field; flavor-specific reporters not created in all variants; test code omitting reporters.
Related errors
- patchReporter must not be null.
- loadReporter must not be null.
- Context must not be null.
- tinkerLoadVerifyFlag must not be null.
- loadReporter is already set.
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/49321fa278b19089.
Report an issue: GitHub.