diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java index 161b122cc9..175166e940 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java @@ -773,9 +773,17 @@ public File getAaptBinaryFile() throws AndrolibException { try { if (OSDetection.isMacOSX()) { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/aapt"); + if (OSDetection.is64Bit()) { + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/64/aapt"); + } else { + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/macosx/32/aapt"); + } } else if (OSDetection.isUnix()) { - aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/aapt"); + if (OSDetection.is64Bit()) { + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/64/aapt"); + } else { + aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/linux/32/aapt"); + } } else if (OSDetection.isWindows()) { aaptBinary = Jar.getResourceAsFile("/prebuilt/aapt/windows/aapt.exe"); } else { diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt new file mode 100755 index 0000000000..d9764cbf21 Binary files /dev/null and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/32/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt new file mode 100755 index 0000000000..32f9f86742 Binary files /dev/null and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/64/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt deleted file mode 100755 index c45a583c0c..0000000000 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt and /dev/null differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt new file mode 100644 index 0000000000..f7a02aa364 Binary files /dev/null and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/32/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt new file mode 100755 index 0000000000..2f7343aff1 Binary files /dev/null and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/64/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt deleted file mode 100644 index a81333337c..0000000000 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt and /dev/null differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe index 597541c122..7827c893b5 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe differ diff --git a/brut.j.util/src/main/java/brut/util/OSDetection.java b/brut.j.util/src/main/java/brut/util/OSDetection.java index 787bffa87f..1157c8d70a 100644 --- a/brut.j.util/src/main/java/brut/util/OSDetection.java +++ b/brut.j.util/src/main/java/brut/util/OSDetection.java @@ -18,17 +18,22 @@ public class OSDetection { private static String OS = System.getProperty("os.name").toLowerCase(); + private static String Bit = System.getProperty("sun.arch.data.model").toLowerCase(); public static boolean isWindows() { - return (OS.indexOf("win") >= 0); + return (OS.contains("win")); } public static boolean isMacOSX() { - return (OS.indexOf("mac") >= 0); + return (OS.contains("mac")); } public static boolean isUnix() { - return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 || (OS.indexOf("sunos") >= 0)); + return (OS.contains("nix") || OS.contains("nux") || OS.contains("aix") || (OS.contains("sunos"))); + } + + public static boolean is64Bit() { + return Bit.equalsIgnoreCase("64"); } public static String returnOS() {