{"record":{"id":"a3215d959c9faa1d","repo":"iBotPeaches/Apktool","slug":"aapt2-binaries-are-not-available-for-32-bit-platfo","errorCode":null,"errorMessage":"aapt2 binaries are not available for 32-bit platforms.","messagePattern":"aapt2 binaries are not available for 32-bit platforms\\.","errorType":"exception","errorClass":"AndrolibException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AaptManager.java","lineNumber":41,"sourceCode":"import brut.util.OSDetection;\n\nimport java.io.File;\n\npublic final class AaptManager {\n\n    private AaptManager() {\n        // Private constructor for utility class.\n    }\n\n    public static String getBinaryName() {\n        return \"aapt2\";\n    }\n\n    public static File getBinaryFile() throws AndrolibException {\n        String binName = getBinaryName();\n\n        if (!OSDetection.is64Bit()) {\n            throw new AndrolibException(binName + \" binaries are not available for 32-bit platforms.\");\n        }\n\n        StringBuilder binPath = new StringBuilder(\"/prebuilt/\");\n        if (OSDetection.isUnix()) {\n            binPath.append(\"linux\"); // ELF 64-bit LSB executable, x86-64\n        } else if (OSDetection.isMacOSX()) {\n            binPath.append(\"macosx\"); // fat binary x86_64 + arm64\n        } else if (OSDetection.isWindows()) {\n            binPath.append(\"windows\"); // x86_64\n        } else {\n            throw new AndrolibException(\"Could not identify platform: \" + OSDetection.returnOS());\n        }\n        binPath.append('/');\n        binPath.append(binName);\n        if (OSDetection.isWindows()) {\n            binPath.append(\".exe\");\n        }\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AaptManager.java#L23-L59","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Install a 64-bit JRE/JDK and ensure `java -version` shows 64-bit, then re-run.","Move the build to a 64-bit machine or container.","Use a 64-bit environment for `apktool b`; decode-only workflows still work in 32-bit."],"exampleFix":"# before (32-bit JVM)\n$ java -version\nopenjdk version \"1.8.0_292\" (32-bit)\n$ apktool b app\n# after (64-bit JVM)\n$ sudo apt install openjdk-17-jre-headless:amd64\n$ java -version\nopenjdk version \"17\" ... 64-bit\n$ apktool b app","handlingStrategy":"validation","validationCode":"if (!brut.util.OSDetection.is64Bit()) {\n    throw new IllegalStateException(\"apktool build requires a 64-bit JRE\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize CI images on 64-bit JVMs and assert `java -version` contains '64-bit'.","Keep decode-only and build steps on separate runners if 32-bit hosts must be used."],"tags":["apktool","aapt2","environment","architecture","build"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}