0

我正在尝试构建 apktool(用于反编译 android apk 文件的工具)。
如何构建的说明位于http://ibotpeaches.github.io/Apktool/build/
问题出在命令./gradlew build fatJar
我收到的错误是:

brut.androlib.SharedLibraryTest > isSharedResourceDecodingAndRebuildingWorking FAILED
    brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 21, --version-name, 5.0-eng.ibotpeaches.20141225.072308, -F, /tmp/APKTOOL134713816630716118.tmp, -0, arsc, -I, /tmp/BRUT4423679278565619004.tmp/1.apk, -I, /tmp/BRUT4423679278565619004.tmp/2-shared.apk, -S, /tmp/BRUT4423679278565619004.tmp/client.apk.out/res, -M, /tmp/BRUT4423679278565619004.tmp/client.apk.out/AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:459)
        at brut.androlib.Androlib.buildResources(Androlib.java:397)
        at brut.androlib.Androlib.build(Androlib.java:285)
        at brut.androlib.SharedLibraryTest.isSharedResourceDecodingAndRebuildingWorking(SharedLibraryTest.java:102)
        Caused by:
        brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 21, --version-name, 5.0-eng.ibotpeaches.20141225.072308, -F, /tmp/APKTOOL134713816630716118.tmp, -0, arsc, -I, /tmp/BRUT4423679278565619004.tmp/1.apk, -I, /tmp/BRUT4423679278565619004.tmp/2-shared.apk, -S, /tmp/BRUT4423679278565619004.tmp/client.apk.out/res, -M, /tmp/BRUT4423679278565619004.tmp/client.apk.out/AndroidManifest.xml]
            at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
            at brut.androlib.Androlib.buildResourcesFull(Androlib.java:445)
            ... 3 more
            Caused by:
            brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 21, --version-name, 5.0-eng.ibotpeaches.20141225.072308, -F, /tmp/APKTOOL134713816630716118.tmp, -0, arsc, -I, /tmp/BRUT4423679278565619004.tmp/1.apk, -I, /tmp/BRUT4423679278565619004.tmp/2-shared.apk, -S, /tmp/BRUT4423679278565619004.tmp/client.apk.out/res, -M, /tmp/BRUT4423679278565619004.tmp/client.apk.out/AndroidManifest.xml]
                at brut.util.OS.exec(OS.java:93)
                at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:413)
                ... 4 more
                Caused by:
                java.io.IOException: Cannot run program "/tmp/brut_util_Jar_9054478823788249311.tmp": error=2, No such file or directory
                    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
                    at java.lang.Runtime.exec(Runtime.java:617)
                    at java.lang.Runtime.exec(Runtime.java:485)
                    at brut.util.OS.exec(OS.java:84)
                    ... 5 more
                    Caused by:
                    java.io.IOException: error=2, No such file or directory
                        at java.lang.UNIXProcess.forkAndExec(Native Method)
                        at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
                        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
                        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
                        ... 8 more
brut.androlib.ProviderAttributeTest > isProviderStringReplacementWorking FAILED
    brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 22, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL5763864884088802643.tmp, -0, arsc, -I, /home/ran/apktool/framework/1.apk, -S, /tmp/BRUT4214352291584370372.tmp/issue636.apk.out/res, -M, /tmp/BRUT4214352291584370372.tmp/issue636.apk.out/AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:459)
        at brut.androlib.Androlib.buildResources(Androlib.java:397)
        at brut.androlib.Androlib.build(Androlib.java:285)
        at brut.androlib.ProviderAttributeTest.isProviderStringReplacementWorking(ProviderAttributeTest.java:59)
        Caused by:
        brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 22, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL5763864884088802643.tmp, -0, arsc, -I, /home/ran/apktool/framework/1.apk, -S, /tmp/BRUT4214352291584370372.tmp/issue636.apk.out/res, -M, /tmp/BRUT4214352291584370372.tmp/issue636.apk.out/AndroidManifest.xml]
            at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
            at brut.androlib.Androlib.buildResourcesFull(Androlib.java:445)
            ... 3 more
            Caused by:
            brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 22, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL5763864884088802643.tmp, -0, arsc, -I, /home/ran/apktool/framework/1.apk, -S, /tmp/BRUT4214352291584370372.tmp/issue636.apk.out/res, -M, /tmp/BRUT4214352291584370372.tmp/issue636.apk.out/AndroidManifest.xml]
                at brut.util.OS.exec(OS.java:93)
                at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:413)
                ... 4 more
                Caused by:
                java.io.IOException: Cannot run program "/tmp/brut_util_Jar_9054478823788249311.tmp": error=2, No such file or directory
                    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
                    at java.lang.Runtime.exec(Runtime.java:617)
                    at java.lang.Runtime.exec(Runtime.java:485)
                    at brut.util.OS.exec(OS.java:84)
                    ... 5 more
                    Caused by:
                    java.io.IOException: error=2, No such file or directory
                        at java.lang.UNIXProcess.forkAndExec(Native Method)
                        at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
                        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
                        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
                        ... 8 more
brut.androlib.BuildAndDecodeJarTest > classMethod FAILED
    brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, -F, /tmp/BRUT3478421848789513632.tmp/testjar.jar, -0, arsc, /tmp/BRUT3478421848789513632.tmp/testjar-orig/build/apk]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
        at brut.androlib.Androlib.buildApk(Androlib.java:661)
        at brut.androlib.Androlib.build(Androlib.java:290)
        at brut.androlib.BuildAndDecodeJarTest.beforeClass(BuildAndDecodeJarTest.java:45)
        Caused by:
        brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, -F, /tmp/BRUT3478421848789513632.tmp/testjar.jar, -0, arsc, /tmp/BRUT3478421848789513632.tmp/testjar-orig/build/apk]
            at brut.util.OS.exec(OS.java:93)
            at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:413)
            ... 3 more
            Caused by:
            java.io.IOException: Cannot run program "/tmp/brut_util_Jar_9054478823788249311.tmp": error=2, No such file or directory
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
                at java.lang.Runtime.exec(Runtime.java:617)
                at java.lang.Runtime.exec(Runtime.java:485)
                at brut.util.OS.exec(OS.java:84)
                ... 4 more
                Caused by:
                java.io.IOException: error=2, No such file or directory
                    at java.lang.UNIXProcess.forkAndExec(Native Method)
                    at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
                    at java.lang.ProcessImpl.start(ProcessImpl.java:130)
                    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
                    ... 7 more
brut.androlib.BuildAndDecodeTest > classMethod FAILED
    brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL4080305473457824664.tmp, -0, arsc, -I, /home/ran/apktool/framework/1.apk, -S, /tmp/BRUT8741597800933526375.tmp/testapp-orig/res, -M, /tmp/BRUT8741597800933526375.tmp/testapp-orig/AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:459)
        at brut.androlib.Androlib.buildResources(Androlib.java:397)
        at brut.androlib.Androlib.build(Androlib.java:285)
        at brut.androlib.BuildAndDecodeTest.beforeClass(BuildAndDecodeTest.java:47)
        Caused by:
        brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL4080305473457824664.tmp, -0, arsc, -I, /home/ran/apktool/framework/1.apk, -S, /tmp/BRUT8741597800933526375.tmp/testapp-orig/res, -M, /tmp/BRUT8741597800933526375.tmp/testapp-orig/AndroidManifest.xml]
            at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
            at brut.androlib.Androlib.buildResourcesFull(Androlib.java:445)
            ... 3 more
            Caused by:
            brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_9054478823788249311.tmp, p, --forced-package-id, 127, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL4080305473457824664.tmp, -0, arsc, -I, /home/ran/apktool/framework/1.apk, -S, /tmp/BRUT8741597800933526375.tmp/testapp-orig/res, -M, /tmp/BRUT8741597800933526375.tmp/testapp-orig/AndroidManifest.xml]
                at brut.util.OS.exec(OS.java:93)
                at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:413)
                ... 4 more
                Caused by:
                java.io.IOException: Cannot run program "/tmp/brut_util_Jar_9054478823788249311.tmp": error=2, No such file or directory
                    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
                    at java.lang.Runtime.exec(Runtime.java:617)
                    at java.lang.Runtime.exec(Runtime.java:485)
                    at brut.util.OS.exec(OS.java:84)
                    ... 5 more
                    Caused by:
                    java.io.IOException: error=2, No such file or directory
                        at java.lang.UNIXProcess.forkAndExec(Native Method)
                        at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
                        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
                        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
                        ... 8 more
6 tests completed, 4 failed
:brut.apktool:apktool-lib:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':brut.apktool:apktool-lib:test'.
> There were failing tests. See the report at: file:///home/ran/Apktool/brut.apktool/apktool-lib/build/reports/tests/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED

我尝试了几次,但收到相同的错误。
我能做些什么来修复它?
(不知何故,它在 Ubuntu 12.04 中有效,但在 Ubuntu 14.04 中无效)。

编辑
jar 文件 ./brut.apktool/apktool-cli/build/libs/apktool-cli.jar 已创建,但错误仍然存​​在。

4

1 回答 1

0

我发现了问题:缺少aapt ...,
要添加 aapt,我必须安装Android SDK,然后运行 ​​Android SDK Manager(android-sdk-linux/tools 中的 ./android),并安装 Android SDK Platform-tools。
aapt位于 android-sdk-linux/built-tools/22.0.1 目录中。
我还必须安装 lib32z1(使用 sudo apt-get install)并将 aapt 目录添加到 PATH 环境变量以使aapt工作。

于 2015-07-14T15:43:51.047 回答