Tencent/tinker · error · TinkerRuntimeException
patch lib file directory not found, warning why the path is
Error message
patch lib file directory not found, warning why the path is null!!!!
What it means
Thrown in TinkerLoadResult when ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST is reported but patchVersionDirectory is null. The intended flow reports the missing native-library directory via onLoadFileNotFound(libraryDirectory, TYPE_LIBRARY, true); the throw is the 'should be not here' fallback proving the reconstructed patch layout does not match what the loader inspected.
Source
Thrown at tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java:244
tinker.getLoadReporter().onLoadFileNotFound(new File(dexOptPath),
ShareConstants.TYPE_DEX_OPT, false);
} else {
ShareTinkerLog.e(TAG, "patch dex opt file not found, but path is null!!!!");
throw new TinkerRuntimeException("patch dex opt file not found, but path is null!!!!");
// tinker.getLoadReporter().onLoadFileNotFound(null,
// ShareConstants.TYPE_DEX, false);
}
break;
case ShareConstants.ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST:
if (patchVersionDirectory != null) {
ShareTinkerLog.e(TAG, "patch lib file directory not found:%s", libraryDirectory.getAbsolutePath());
tinker.getLoadReporter().onLoadFileNotFound(libraryDirectory,
ShareConstants.TYPE_LIBRARY, true);
} else {
//should be not here
ShareTinkerLog.e(TAG, "patch lib file directory not found, warning why the path is null!!!!");
throw new TinkerRuntimeException("patch lib file directory not found, warning why the path is null!!!!");
// tinker.getLoadReporter().onLoadFileNotFound(null,
// ShareConstants.TYPE_LIBRARY, true);
}
break;
case ShareConstants.ERROR_LOAD_PATCH_VERSION_LIB_FILE_NOT_EXIST:
String libPath = ShareIntentUtil.getStringExtra(intentResult,
ShareIntentUtil.INTENT_PATCH_MISSING_LIB_PATH);
if (libPath != null) {
//we only pass one missing file and then we break
ShareTinkerLog.e(TAG, "patch lib file not found:%s", libPath);
tinker.getLoadReporter().onLoadFileNotFound(new File(libPath),
ShareConstants.TYPE_LIBRARY, false);
} else {
ShareTinkerLog.e(TAG, "patch lib file not found, but path is null!!!!");
throw new TinkerRuntimeException("patch lib file not found, but path is null!!!!");
// tinker.getLoadReporter().onLoadFileNotFound(null,View on GitHub (pinned to 1b7ea02c23)
Solutions
- cleanPatch() to wipe inconsistent state, then re-apply the patch.
- Verify the patch APK was built with the same tinker gradle plugin version as the loader in the base APK.
- Guard against partial writes by only applying fully downloaded patch files (tinker's default patch apply already validates md5; do not bypass it).
- Inspect /tinker/patch info + version dirs on a reproducible device via run-as or adb backup.
Defensive patterns
Strategy: try-catch
Validate before calling
File versionDir = tinker.getTinkerLoadResultIfPresent() != null
? tinker.getTinkerLoadResultIfPresent().patchVersionDirectory : null;
if (versionDir != null && !(new File(versionDir, "lib")).isDirectory()) {
tinker.cleanPatch();
} Try / catch
catch (TinkerRuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("lib file directory not found")) {
Tinker.with(app).cleanPatch();
} else throw e;
} Prevention
- Never manually delete files under the tinker patch directory
- Apply patches only from fully validated downloads
When it happens
Trigger: Loader returns ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST while the versioned patch directory File resolves to null — i.e. patch metadata exists but its lib/ subdirectory path cannot even be constructed.
Common situations: Patch info file corrupted mid-write (process killed during patch apply); tinker directories partially deleted; patch built with a gradle plugin that emits a different directory layout than the loader expects.
Related errors
- patch dex file directory not found, warning why the path is
- patch lib file not found, but path is null!!!!
- patch resource file directory not found, warning why the pat
- patch resource file not found, warning why the path is null!
- patch ${type} extract failed (${message}).
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/a514b29233391df3.
Report an issue: GitHub.