Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apktool build apk fails

Tags:

I am experiencing very annoying problems with the application apktool problem. I do not understand what i am doing wrong, or what the problem is. I tried this on debian , and on linux mint. I used different versions of apktool,

resulting in the same error:

I: Checking whether sources has changed... 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/APKTOOL3630495287059303807.tmp, -I, /home/awesomename/apktool/framework/1.apk, -S, /home/awesomename/out/./res, -M, /home/awesomename/out/./AndroidManifest.xml]     at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)     at brut.androlib.Androlib.buildResourcesFull(Unknown Source)     at brut.androlib.Androlib.buildResources(Unknown Source)     at brut.androlib.Androlib.build(Unknown Source)     at brut.androlib.Androlib.build(Unknown Source)     at brut.apktool.Main.cmdBuild(Unknown Source)     at brut.apktool.Main.main(Unknown Source) Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL3630495287059303807.tmp, -I, /home/windows/apktool/framework/1.apk, -S, /home/windows/out/./res, -M, /home/windows/out/./AndroidManifest.xml]     at brut.util.OS.exec(Unknown Source)     ... 7 more Caused by: java.io.IOException: Cannot run program "aapt": error=2, No such file or directory     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)     at java.lang.Runtime.exec(Runtime.java:617)     at java.lang.Runtime.exec(Runtime.java:485)     ... 8 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:135)     at java.lang.ProcessImpl.start(ProcessImpl.java:130)     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)     ... 10 more 

It seems it can not use aapt , but i read about apktool. And it seems that aapt is build inside apktool , why is it not working ?

like image 298
user3046636 Avatar asked Apr 26 '14 22:04

user3046636


People also ask

How do I fix an Apktool error?

- Clear framework apktool empty-framework-dir --force and decompile the APK again. - Decompile APK with --no-res if you are only editing Java (smali) (--no-res will prevent the decompile of resources. This keeps the resources.

What is the command to decompile the APK using Apktool?

For decompiling use the command "d". The "d" stands for decompile.


2 Answers

It seems there's some problem in building the resources while recompiling the apk. what you can do is, when you decompile your apk use this command

apktool d -f -r apkfilename.apk 

here -f is to replace previous decompiled apk's code and -r is to ignore the decompiling of resources.

this would prevent the resources from being decompiled and will simply copy the same resources when you recompile the apk.

like image 89
Ravinder Bhandari Avatar answered Oct 29 '22 22:10

Ravinder Bhandari


In case you've been using v1 and now upgraded to v2, try manually deleting the framework file.

On windows 8 it's normally at C:\Users\YourName\apktool\framework\1.apk.

The file should be regenerated once you try to build something.

like image 24
Michael Litvin Avatar answered Oct 29 '22 20:10

Michael Litvin