iBotPeaches/Apktool · error · AndrolibException

aapt2 binaries are not available for 32-bit platforms.

Error message

aapt2 binaries are not available for 32-bit platforms.

What it means

AndrolibException thrown by AaptManager.getBinaryFile() when the host JVM reports a 32-bit architecture. Since apktool 2.4+ the aapt2 binary is bundled inside the jar and only 64-bit builds (linux x86-64, macos x86_64+arm64 fat, windows x86_64) are shipped, so resource packing during `apktool b` cannot run on 32-bit systems using the bundled binary.

Source

Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AaptManager.java:41

import brut.util.OSDetection;

import java.io.File;

public final class AaptManager {

    private AaptManager() {
        // Private constructor for utility class.
    }

    public static String getBinaryName() {
        return "aapt2";
    }

    public static File getBinaryFile() throws AndrolibException {
        String binName = getBinaryName();

        if (!OSDetection.is64Bit()) {
            throw new AndrolibException(binName + " binaries are not available for 32-bit platforms.");
        }

        StringBuilder binPath = new StringBuilder("/prebuilt/");
        if (OSDetection.isUnix()) {
            binPath.append("linux"); // ELF 64-bit LSB executable, x86-64
        } else if (OSDetection.isMacOSX()) {
            binPath.append("macosx"); // fat binary x86_64 + arm64
        } else if (OSDetection.isWindows()) {
            binPath.append("windows"); // x86_64
        } else {
            throw new AndrolibException("Could not identify platform: " + OSDetection.returnOS());
        }
        binPath.append('/');
        binPath.append(binName);
        if (OSDetection.isWindows()) {
            binPath.append(".exe");
        }

View on GitHub (pinned to 79b63384d7)

Solutions

  1. Install a 64-bit JRE/JDK and ensure `java -version` shows 64-bit, then re-run.
  2. Move the build to a 64-bit machine or container.
  3. Use a 64-bit environment for `apktool b`; decode-only workflows still work in 32-bit.

Example fix

# before (32-bit JVM)
$ java -version
openjdk version "1.8.0_292" (32-bit)
$ apktool b app
# after (64-bit JVM)
$ sudo apt install openjdk-17-jre-headless:amd64
$ java -version
openjdk version "17" ... 64-bit
$ apktool b app
Defensive patterns

Strategy: validation

Validate before calling

if (!brut.util.OSDetection.is64Bit()) {
    throw new IllegalStateException("apktool build requires a 64-bit JRE");
}

Prevention

When it happens

Trigger: Running `apktool b` on a 32-bit JVM/OS (e.g. i686 Linux, 32-bit Windows) without specifying a custom aapt path; os.arch reporting x86/i386/ppc(32) so OSDetection.is64Bit() returns false.

Common situations: Old 32-bit CI containers; lightweight 32-bit VPS or WSL1 setups; a 64-bit machine running a 32-bit JRE (e.g. default-jre on some legacy Debian installs).

Related errors


AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14). Data as JSON: /api/errors/a3215d959c9faa1d. Report an issue: GitHub.