简体   繁体   中英

Decompile and Recompile apk files on ubuntu

I am trying to modify an Android app using apktool.

I've downloaded the apktool and now I have 3 file apktool, aapt and apktool.jar

I am trying to modify the background of the Gallery_3D.apk

I am using these command to decompile and then recompile

./apktool if Gallery 3D.apk
./apktool d Gallery 3D.apk gallery

It works fine for above 2 steps but while recompiling using command

./apktool b gallery Gallery 3D New.apk

However I am getting this error in the last step.

I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL4811911322257021960.tmp, -I, /home/seat2/apktool/framework/1.apk, -S, /home/seat2/Desktop/apktool/gallery/res, -M, /home/seat2/Desktop/apktool/gallery/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
    at brut.androlib.Androlib.buildResources(Androlib.java:248)
    at brut.androlib.Androlib.build(Androlib.java:171)
    at brut.androlib.Androlib.build(Androlib.java:154)
    at brut.apktool.Main.cmdBuild(Main.java:182)
    at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL4811911322257021960.tmp, -I, /home/seat2/apktool/framework/1.apk, -S, /home/seat2/Desktop/apktool/gallery/res, -M, /home/seat2/Desktop/apktool/gallery/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:87)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
    ... 6 more
Caused by: java.io.IOException: Cannot run program "aapt": java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
    at java.lang.Runtime.exec(Runtime.java:610)
    at java.lang.Runtime.exec(Runtime.java:483)
    at brut.util.OS.exec(OS.java:78)
    ... 7 more
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
    ... 10 more

I know this is quite old answer, but I'm going to post the solution in case somebody still need help.

The first problem, was pointed out by RC: you need to add aapt to your path. You can do this with the following command:

PATH=$PATH:/location/of/aapt

To fix the second problem ( INSTALL_PARSE_FAILED_NO_CERTIFICATES ), you need to sign your apk. You can do this using testsign.jar:

java -jar testsign.jar unsigned.apk signed.apk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM