{"record":{"id":"c47ea3cf59d42fc8","repo":"Tencent/tinker","slug":"intentresult-must-not-be-null","errorCode":null,"errorMessage":"intentResult must not be null.","messagePattern":"intentResult must not be null\\.","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"error","filePath":"tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java","lineNumber":153,"sourceCode":"     * you must install tinker first!!\n     *\n     * @param intentResult\n     * @param serviceClass\n     * @param upgradePatch\n     */\n    public void install(Intent intentResult, Class<? extends AbstractResultService> serviceClass,\n                        AbstractPatch upgradePatch) {\n        sInstalled = true;\n        TinkerPatchService.setPatchProcessor(upgradePatch, serviceClass);\n\n        ShareTinkerLog.i(TAG, \"try to install tinker, isEnable: %b, version: %s\", isTinkerEnabled(), ShareConstants.TINKER_VERSION);\n\n        if (!isTinkerEnabled()) {\n            ShareTinkerLog.e(TAG, \"tinker is disabled\");\n            return;\n        }\n        if (intentResult == null) {\n            throw new TinkerRuntimeException(\"intentResult must not be null.\");\n        }\n        tinkerLoadResult = new TinkerLoadResult();\n        tinkerLoadResult.parseTinkerResult(getContext(), intentResult);\n        //after load code set\n        loadReporter.onLoadResult(patchDirectory, tinkerLoadResult.loadCode, tinkerLoadResult.costTime);\n\n        if (!loaded) {\n            ShareTinkerLog.w(TAG, \"tinker load fail!\");\n        }\n    }\n\n    /**\n     * set tinkerPatchServiceNotificationId\n     *\n     * @param id\n     */\n    public void setPatchServiceNotificationId(int id) {\n        TinkerPatchService.setTinkerNotificationId(id);","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L135-L171","documentation":"Tinker.install(Intent, Class, AbstractPatch) is the low-level install used after the patch-loading phase: the Intent carries the load result produced by the loader in TinkerApplication. A null intentResult means the load outcome is unknown/absent, and tinker refuses to finish installation rather than fabricate a load result.","triggerScenarios":"Invoking tinker.install(intentResult, serviceClass, upgradePatch) with a null Intent — typically when custom code calls install manually instead of letting TinkerApplication/TinkerApplicationInternals deliver the load-result intent, or when using the generated application incorrectly.","commonSituations":"Migrating from the annotation-based TinkerApplication to manual initialization and passing null; calling install in a process where the patch loader never ran; refactors that drop the load-result intent plumbing.","solutions":["Prefer the no-arg tinker.install() overload after the loader has run, letting tinker read the persisted load result.","If using the Intent overload, pass the exact intent delivered by the loading phase (TinkerApplicationInternals), never null.","Ensure your Application delegates to the tinker loader (via TinkerApplication or generated stub) before install.","Gate on intentResult != null or TinkerLoadResult presence before calling the Intent overload."],"exampleFix":"// before\ntinker.install(null, ResultService.class, new UpgradePatch());\n\n// after\ntinker.install(); // reads the load result recorded by the loader","handlingStrategy":"validation","validationCode":"// Prefer the no-arg overload after the loader ran:\nif (tinkerLoadResultAlreadyAvailable()) {\n    tinker.install();\n} else if (loadResultIntent != null) {\n    tinker.install(loadResultIntent, ResultService.class, new UpgradePatch());\n} else {\n    throw new IllegalStateException(\"tinker load result unavailable\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Let the tinker loader (TinkerApplication / generated application) produce the load result before install.","Use the no-arg install() in custom ApplicationLike flows.","Never forward null Intents into install; assert non-null at the call site."],"tags":["tinker","android","initialization","intent","null-check"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}