Tencent/tinker · error · TinkerRuntimeException
loadReporter must not be null.
Error message
loadReporter must not be null.
What it means
Builder.loadReport(LoadReporter) rejects a null reporter. The LoadReporter receives load callbacks (success/failure, patch version change), and Tinker's internals invoke it unconditionally after install, so a null value would NPE later in the lifecycle; the builder fails fast instead.
Source
Thrown at tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java:386
}
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 your LoadReporter implementation before building Tinker and pass the instance.
- If callbacks are unwanted, pass DefaultLoadReporter rather than null.
- Initialize DI bindings before tinker setup, or create the reporter inline in the builder chain.
Example fix
// before builder.loadReport(loadReporter); // loadReporter field still null // after builder.loadReport(new DefaultLoadReporter(context)); // or initialize the field before building
Defensive patterns
Strategy: validation
Validate before calling
LoadReporter reporter = (loadReporter != null) ? loadReporter : new DefaultLoadReporter(context); builder.loadReport(reporter);
Type guard
public static LoadReporter orDefault(LoadReporter r, Context ctx) {
return r != null ? r : new DefaultLoadReporter(ctx);
} Prevention
- Construct reporter instances before the builder chain runs.
- Pass DefaultLoadReporter/DefaultPatchReporter instead of null when callbacks are unwanted.
- Initialize DI-provided dependencies before tinker setup.
When it happens
Trigger: Calling loadReport(null) — typically a reporter field not yet initialized at builder time, or wiring code that passes an optional dependency.
Common situations: Custom ApplicationLike where the reporter is constructed after the builder; DI container returning null for an unbound LoadReporter; tests stubbing the reporter as null.
Related errors
- loadReporter must not be null.
- patchReporter 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/4081c74ad35bbc2b.
Report an issue: GitHub.