Search code examples
androidubuntuapktool

apktool cannot recompile the apk after (decode and then build)


I am trying to extract the apk and then recompile with the use of apktool, however it show the error like below. What do these errors mean? How to solve it?

Ref to this(http://ibotpeaches.github.io/Apktool/documentation/) I just simply use apktool d xxx.apk and apktool b yyy -o xxx_modified.apk

My Working Environment:

xxxx/test$ uname -a Linux xxx 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Error Code:

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_49135464892749518.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL499773345384388135.tmp, -0, resources.arsc, -0, arsc, -I, /home/fyp/apktool/framework/1.apk, -S, /home/fyp/fyp201516/test/a.apk_temp/res, -M, /home/fyp/fyp201516/test/a.apk_temp/AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:465)
        at brut.androlib.Androlib.buildResources(Androlib.java:403)
        at brut.androlib.Androlib.build(Androlib.java:291)
        at brut.androlib.Androlib.build(Androlib.java:261)
        at brut.apktool.Main.cmdBuild(Main.java:225)
        at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_49135464892749518.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL499773345384388135.tmp, -0, resources.arsc, -0, arsc, -I, /home/fyp/apktool/framework/1.apk, -S, /home/fyp/fyp201516/test/a.apk_temp/res, -M, /home/fyp/fyp201516/test/a.apk_temp/AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:451)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_49135464892749518.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 21, --version-code, 1, --version-name, 1.0, -F, /tmp/APKTOOL499773345384388135.tmp, -0, resources.arsc, -0, arsc, -I, /home/fyp/apktool/framework/1.apk, -S, /home/fyp/fyp201516/test/a.apk_temp/res, -M, /home/fyp/fyp201516/test/a.apk_temp/AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:93)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
        ... 6 more
Caused by: java.io.IOException: Cannot run program "/tmp/brut_util_Jar_49135464892749518.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)
        ... 7 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:187)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
        ... 10 more

Solution

  • [Problem solved]

    the reason is because the latest sdk not yet install Here is the link to install latest android sdk:

    https://askubuntu.com/questions/318246/complete-installation-guide-for-android-sdk-adt-bundle-on-ubuntu