Tencent/tinker · error · TinkerRuntimeException

patch dex file not found, but path is null!!!!

Error message

patch dex file not found, but path is null!!!!

What it means

TinkerLoadResult handles ERROR_LOAD_PATCH_VERSION_DEX_FILE_NOT_EXIST by reading the missing dex path from the intent extra INTENT_PATCH_MISSING_DEX_PATH and reporting it via onLoadFileNotFound. If that extra is absent (null), Tinker cannot tell which dex file is missing, so it throws this TinkerRuntimeException — again a defensive 'this should not happen' branch indicating the result intent was malformed or produced by mismatched loader/library versions.

Source

Thrown at tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java:215

                        ShareConstants.TYPE_DEX, true);
                } else {
                    //should be not here
                    ShareTinkerLog.e(TAG, "patch dex file directory not found, warning why the path is null!!!!");
                    throw new TinkerRuntimeException("patch dex file directory not found, warning why the path is null!!!!");
                }
                break;
            case ShareConstants.ERROR_LOAD_PATCH_VERSION_DEX_FILE_NOT_EXIST:
                String dexPath = ShareIntentUtil.getStringExtra(intentResult,
                    ShareIntentUtil.INTENT_PATCH_MISSING_DEX_PATH);
                if (dexPath != null) {
                    //we only pass one missing file
                    ShareTinkerLog.e(TAG, "patch dex file not found:%s", dexPath);
                    tinker.getLoadReporter().onLoadFileNotFound(new File(dexPath),
                        ShareConstants.TYPE_DEX, false);

                } else {
                    ShareTinkerLog.e(TAG, "patch dex file not found, but path is null!!!!");
                    throw new TinkerRuntimeException("patch dex file not found, but path is null!!!!");
                    // tinker.getLoadReporter().onLoadFileNotFound(null,
                    //     ShareConstants.TYPE_DEX, false);
                }
                break;
            case ShareConstants.ERROR_LOAD_PATCH_VERSION_DEX_OPT_FILE_NOT_EXIST:
                String dexOptPath = ShareIntentUtil.getStringExtra(intentResult,
                    ShareIntentUtil.INTENT_PATCH_MISSING_DEX_PATH);
                if (dexOptPath != null) {
                    //we only pass one missing file
                    ShareTinkerLog.e(TAG, "patch dex opt file not found:%s", dexOptPath);
                    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);

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. Run cleanPatch() and re-apply the patch to restore a consistent dex set.
  2. Ensure tinker-android-lib, tinker-android-loader and the gradle plugin all come from the same Tinker release version.
  3. Check that nothing (cleanup tool, backup/restore app) deletes individual *.dex files inside /tinker/<version>/dex/.
  4. Collect ShareTinkerLog output to identify which dex operation emitted the result code without a path.
Defensive patterns

Strategy: try-catch

Try / catch

catch (TinkerRuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("dex file not found, but path is null")) {
        Tinker.with(app).cleanPatch();
    } else throw e;
}

Prevention

When it happens

Trigger: Loader returns ERROR_LOAD_PATCH_VERSION_DEX_FILE_NOT_EXIST without setting the INTENT_PATCH_MISSING_DEX_PATH string extra in the result intent. Can occur when the dex-parsing code path that raises the error forgets to attach the path, or when the intent is reconstructed/stripped by another component.

Common situations: Version skew between the tinker-android-loader compiled into the app and the tinker-android-lib reporting the result; ROM/vendor intent tampering; a specific dex being deleted from the patch directory after install (root tools, storage cleaners).

Related errors


AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14). Data as JSON: /api/errors/f74ab93acc777faa. Report an issue: GitHub.