iBotPeaches/Apktool · error · AndrolibException
Could not identify platform: " + OSDetection.returnOS()
Error message
Could not identify platform: " + OSDetection.returnOS()
What it means
AndrolibException thrown by AaptManager.getBinaryFile() when OSDetection cannot classify the host into linux/macosx/windows (checked in that order). The bundled aapt2 lookup table only covers those three platforms, so anything else (e.g. FreeBSD, Solaris, aix, or an unrecognized os.name/os.arch combination) aborts before any resource path is built.
Source
Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AaptManager.java:52
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");
}
File binFile;
try {
binFile = Jar.getResourceAsFile(AaptManager.class, binPath.toString(), binName + "_");
} catch (BrutException ex) {
throw new AndrolibException(ex);
}
setBinaryExecutable(binFile);
return binFile;
}
private static void setBinaryExecutable(File binFile) throws AndrolibException {View on GitHub (pinned to 79b63384d7)
Solutions
- Run the build inside a Linux container or VM (e.g. docker run ... apktool b).
- Cross-build on a supported platform and copy artifacts back.
- For pure-java decode tasks, note that only build (`b`) needs the native aapt2.
Example fix
# before $ apktool b app # on FreeBSD host # after $ docker run --rm -v "$PWD":/w -w /w ibotpeaches/apktool:latest b app
Defensive patterns
Strategy: fallback
Validate before calling
String os = OSDetection.returnOS();
if (!(OSDetection.isUnix() || OSDetection.isMacOSX() || OSDetection.isWindows())) {
// run build in a Linux container instead
} Prevention
- Run apktool builds inside a Linux docker image for platform independence.
- Document supported host platforms (linux/macos/windows x64) in tooling docs.
When it happens
Trigger: Running `apktool b` on an OS whose os.name is not Linux, Mac OS X, or Windows — e.g. FreeBSD, OpenBSD, Solaris; or a JVM returning an unexpected os.name string.
Common situations: Building APKs inside BSD or Solaris zones/containers; exotic JVMs that normalize os.name differently; running under emulation layers that report an unusual platform.
Related errors
- aapt2 binaries are not available for 32-bit platforms.
- Could not read aapt binary: " + binFile.getPath()
- Could not set aapt binary as executable:
- Could not execute aapt binary at location:
- Malicious value for apkFileName: " + mApkFileName
AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14).
Data as JSON: /api/errors/59260229f5cdf110.
Report an issue: GitHub.