Tencent/tinker · error · TinkerRuntimeException
getCurrentInstructionSet fail:
Error message
getCurrentInstructionSet fail:
What it means
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.
Source
Thrown at tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/SharePatchFileUtil.java:498
/**
* change the jar file path as the makeDexElements do
* Android O change its path
*
* @param path
* @param optimizedDirectory
* @return
*/
public static String optimizedPathFor(File path, File optimizedDirectory) {
if (ShareTinkerInternals.isAfterAndroidO()) {
// dex_location = /foo/bar/baz.jar
// odex_location = /foo/bar/oat/<isa>/baz.odex
String currentInstructionSet;
try {
currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSet();
} catch (Exception e) {
throw new TinkerRuntimeException("getCurrentInstructionSet fail:", e);
}
File parentFile = path.getParentFile();
String fileName = path.getName();
int index = fileName.lastIndexOf('.');
if (index > 0) {
fileName = fileName.substring(0, index);
}
String result = parentFile.getAbsolutePath() + "/oat/"
+ currentInstructionSet + "/" + fileName + ShareConstants.ODEX_SUFFIX;
return result;
}
String fileName = path.getName();
if (!fileName.endsWith(ShareConstants.DEX_SUFFIX)) {
int lastDot = fileName.lastIndexOf(".");
if (lastDot < 0) {View on GitHub (pinned to 1b7ea02c23)
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.
Example fix
// before
currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSet();
// after (caller-side guard)
try {
currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSet();
} catch (Throwable t) {
currentInstructionSet = ShareTinkerInternals.getCurrentInstructionSetByABI();
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check ABI is one Tinker supports before odex path computation
String abi = Build.CPU_ABI;
if (!Arrays.asList("armeabi-v7a","arm64-v8a","x86","x86_64","mips","mips64").contains(abi)) {
// skip odex path computation on this device
} Try / catch
try {
String odexPath = SharePatchFileUtil.optimizedPathFor(dexFile, dir);
} catch (TinkerRuntimeException e) {
Throwable cause = e.getCause(); // IllegalStateException 'Unsupported abi' etc.
// skip oat-dependent logic on this device
} Prevention
- 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.
When it happens
Trigger: optimizedPathFor(dexFile, dir) on API 26+ when getCurrentInstructionSet() throws — typically its underlying lookup fails or Build.CPU_ABI hits an unsupported value.
Common situations: 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.
Related errors
- Bad isa num: {}
- Unsupported abi:
- patch %s extract failed (%s).
- patch dex opt file not found, but path is null!!!!
- Unable to find .rodata section.
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/aa26a22dc01587bc.
Report an issue: GitHub.