Tencent/tinker · critical · TinkerRuntimeException
createDelegate failed
Error message
createDelegate failed
What it means
TinkerApplication.createDelegate reflectively loads the ApplicationLike delegate class (Class.forName with the app's classloader), locates its (Application, int, boolean, long, long, Intent) constructor and instantiates it. Any failure — class not found, no such constructor, instantiation error — is wrapped in TinkerRuntimeException('createDelegate failed', thr). The delegate is generated by the tinker gradle plugin, so a mismatch between the configured delegate class name and what the build actually produced is the classic trigger.
Source
Thrown at tinker-android/tinker-android-loader-no-op/src/main/java/com/tencent/tinker/loader/app/TinkerApplication.java:102
}
private ApplicationLike createDelegate(Application app,
int tinkerFlags,
String delegateClassName,
boolean tinkerLoadVerifyFlag,
long applicationStartElapsedTime,
long applicationStartMillisTime,
Intent resultIntent) {
try {
// Use reflection to create the delegate so it doesn't need to go into the primary dex.
// And we can also patch it
final Class<?> delegateClass = Class.forName(delegateClassName, false, mCurrentClassLoader);
final Constructor<?> constructor = delegateClass.getConstructor(Application.class, int.class, boolean.class,
long.class, long.class, Intent.class);
return (ApplicationLike) constructor.newInstance(app, tinkerFlags, tinkerLoadVerifyFlag,
applicationStartElapsedTime, applicationStartMillisTime, resultIntent);
} catch (Throwable thr) {
throw new TinkerRuntimeException("createDelegate failed", thr);
}
}
protected void onBaseContextAttached(Context base, long applicationStartElapsedTime, long applicationStartMillisTime) {
try {
mCurrentClassLoader = base.getClassLoader();
this.tinkerResultIntent = new Intent();
ShareIntentUtil.setIntentReturnCode(this.tinkerResultIntent, ShareConstants.ERROR_LOAD_DISABLE);
mAppLike = createDelegate(this, tinkerFlags, delegateClassName,
tinkerLoadVerifyFlag, applicationStartElapsedTime, applicationStartMillisTime,
tinkerResultIntent);
mAppLike.onBaseContextAttached(base);
} catch (TinkerRuntimeException e) {
throw e;
} catch (Throwable thr) {
throw new TinkerRuntimeException(thr.getMessage(), thr);
}
}View on GitHub (pinned to 1b7ea02c23)
Solutions
- Check the cause inside the TinkerRuntimeException: ClassNotFoundException => the delegate class name from the gradle config is wrong or was obfuscated away; NoSuchMethodException => tinker component version mismatch.
- Use matching versions of tinker-android-lib, tinker-android-loader and the gradle plugin in one build.
- Add proguard keep rules for your ApplicationLike subclass (e.g. -keep public class * extends com.tencent.tinker.loader.app.ApplicationLike).
- Verify the manifest/gradle delegate class name matches the generated class (build/intermediates/tinker/...).
Example fix
# proguard-rules.pro
# before: delegate obfuscated -> createDelegate failed at runtime
# after: keep the generated ApplicationLike
-keep public class * extends com.tencent.tinker.loader.app.ApplicationLike {
public <init>(android.app.Application, int, boolean, long, long, android.content.Intent);
} Defensive patterns
Strategy: try-catch
Try / catch
try {
appLike = createDelegate(...);
} catch (TinkerRuntimeException e) {
Throwable cause = e.getCause();
// ClassNotFoundException -> wrong/obfuscated delegate name
// NoSuchMethodException -> tinker version mismatch
logOrReport(cause);
} Prevention
- Pin tinker lib, loader and plugin to one version
- Keep the generated ApplicationLike subclass and its constructor from proguard
- Verify the delegate class exists in the primary dex of the base APK
When it happens
Trigger: Class.forName(delegateClassName) fails (delegate class absent from the base dex), getConstructor fails (signature changed across tinker versions), or newInstance throws (delegate constructor exception). Typical with an incorrect tinkerOldApk/apply mapping, obfuscated builds where the generated delegate was renamed, or a tinker loader/library version combination with different constructor signatures.
Common situations: Upgrading tinker runtime but keeping an old patch/base mixing component versions; enabling proguard without keeping the generated ApplicationLike subclass; manually editing the delegate class name in build.gradle; multidex config that moves the delegate out of the primary dex on some devices.
Related errors
- createInlineFence failed
- Cannot query transaction code of performDexOptSecondary.
- resource references is null
- Fail to hack resourceImpls field.
- failed to fetch instance of ActivityThread.
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/e9da3b069cef7cde.
Report an issue: GitHub.