{"record":{"id":"aa26a22dc01587bc","repo":"Tencent/tinker","slug":"getcurrentinstructionset-fail-aa26a2","errorCode":null,"errorMessage":"getCurrentInstructionSet fail:","messagePattern":"getCurrentInstructionSet fail:","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"error","filePath":"tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/SharePatchFileUtil.java","lineNumber":498,"sourceCode":"\n    /**\n     * change the jar file path as the makeDexElements do\n     * Android O change its path\n     *\n     * @param path\n     * @param optimizedDirectory\n     * @return\n     */\n    public static String optimizedPathFor(File path, File optimizedDirectory) {\n        if (ShareTinkerInternals.isAfterAndroidO()) {\n            // dex_location = /foo/bar/baz.jar\n            // odex_location = /foo/bar/oat/<isa>/baz.odex\n\n            String currentInstructionSet;\n            try {\n                currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSet();\n            } catch (Exception e) {\n                throw new TinkerRuntimeException(\"getCurrentInstructionSet fail:\", e);\n            }\n\n            File parentFile = path.getParentFile();\n            String fileName = path.getName();\n            int index = fileName.lastIndexOf('.');\n            if (index > 0) {\n                fileName = fileName.substring(0, index);\n            }\n\n            String result = parentFile.getAbsolutePath() + \"/oat/\"\n                + currentInstructionSet + \"/\" + fileName + ShareConstants.ODEX_SUFFIX;\n            return result;\n        }\n\n        String fileName = path.getName();\n        if (!fileName.endsWith(ShareConstants.DEX_SUFFIX)) {\n            int lastDot = fileName.lastIndexOf(\".\");\n            if (lastDot < 0) {","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/SharePatchFileUtil.java#L480-L516","documentation":"SharePatchFileUtil.optimizedPathFor on Android O+ needs the current instruction set to build the odex path (/oat/<isa>/xxx.odex). It calls ShareTinkerInternals.getCurrentInstructionSet(); if that throws (unsupported ABI property etc.), it rethrows TinkerRuntimeException(\"getCurrentInstructionSet fail:\", e). The cause carries the real failure.","triggerScenarios":"optimizedPathFor(dexFile, dir) on API 26+ when getCurrentInstructionSet() throws — typically its underlying lookup fails or Build.CPU_ABI hits an unsupported value.","commonSituations":"New or unusual ABIs not in the switch (armeabi-v profiles, new ISAs on preview ROMs); system properties unavailable in restricted contexts; emulator images with odd ABI strings.","solutions":["Inspect the chained cause to see whether the failure is the ABI switch or property read.","Ensure the app is not running under an ABI unsupported by the switch in ShareTinkerInternals (add it if you control a fork).","Run patch loading on the main process under normal runtime conditions where Build.CPU_ABI is reliable.","Update Tinker to a version covering newer ABIs."],"exampleFix":"// before\ncurrentInstructionSet = ShareTinkerInternals.getCurrentInstructionSet();\n// after (caller-side guard)\ntry {\n    currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSet();\n} catch (Throwable t) {\n    currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSetByABI();\n}","handlingStrategy":"try-catch","validationCode":"// Pre-check ABI is one Tinker supports before odex path computation\nString abi = Build.CPU_ABI;\nif (!Arrays.asList(\"armeabi-v7a\",\"arm64-v8a\",\"x86\",\"x86_64\",\"mips\",\"mips64\").contains(abi)) {\n    // skip odex path computation on this device\n}","typeGuard":null,"tryCatchPattern":"try {\n    String odexPath = SharePatchFileUtil.optimizedPathFor(dexFile, dir);\n} catch (TinkerRuntimeException e) {\n    Throwable cause = e.getCause(); // IllegalStateException 'Unsupported abi' etc.\n    // skip oat-dependent logic on this device\n}","preventionTips":["Gate patch distribution on supported ABI lists.","Inspect the wrapped cause to distinguish ABI problems from property-read problems.","Keep Tinker's ABI map current when adopting new devices."],"tags":["android","tinker","instruction-set","abi","odex"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}