无法在Ubuntu 14.04上构建apktool

时间:2015-07-14 11:38:43

标签: ubuntu-14.04 apktool

我正在尝试构建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)。

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

1 个答案:

答案 0 :(得分: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 env变量中,以使 aapt 正常工作。