Skip to content

Fix dex2oat crash on Android 10 due to architecture mismatch#521

Merged
JingMatrix merged 1 commit intomasterfrom
android10
Jan 28, 2026
Merged

Fix dex2oat crash on Android 10 due to architecture mismatch#521
JingMatrix merged 1 commit intomasterfrom
android10

Conversation

@JingMatrix
Copy link
Owner

Previously, the daemon determined the architecture of the target dex2oat binary based on its own process architecture (Process.is64Bit()). On Android 10, /apex/com.android.runtime/bin/dex2oat is frequently a 32-bit binary, even on 64-bit devices.

This caused the daemon to incorrectly treat the target as 64-bit and mount the 64-bit wrapper (bin/dex2oat64). Consequently, the wrapper attempted to execute the 32-bit binary using linker64, resulting in a crash: error: "/apex/.../dex2oat" is 32-bit instead of 64-bit

This commit changes the logic to inspect the ELF header of the target binary. We now explicitly check e_ident[EI_CLASS] to determine if the file is 32-bit or 64-bit and assign it to the correct mounting slot. This ensures the 32-bit wrapper is mounted over 32-bit targets, preventing the linker mismatch.

Previously, the daemon determined the architecture of the target `dex2oat` binary based on its own process architecture (`Process.is64Bit()`).
On Android 10, `/apex/com.android.runtime/bin/dex2oat` is frequently a 32-bit binary, even on 64-bit devices.

This caused the daemon to incorrectly treat the target as 64-bit and mount the 64-bit wrapper (`bin/dex2oat64`). Consequently, the wrapper attempted to execute the 32-bit binary using `linker64`, resulting in a crash: `error: "/apex/.../dex2oat" is 32-bit instead of 64-bit`

This commit changes the logic to inspect the ELF header of the target binary. We now explicitly check `e_ident[EI_CLASS]` to determine if the file is 32-bit or 64-bit and assign it to the correct mounting slot. This ensures the 32-bit wrapper is mounted over 32-bit targets, preventing the linker mismatch.
@JingMatrix JingMatrix merged commit 047ad98 into master Jan 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant