when I run Apktool to build a package for android I get this output:
:~$ apktool build '/home/...' 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/APKTOOL3418222472327622786.tmp, -I,
/home/apktool/framework/1.apk, -S, /home/.../ /home/.../AndroidManifest.xml] at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255) at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324) at brut.androlib.Androlib.buildResources(Androlib.java:269) at brut.androlib.Androlib.build(Androlib.java:192) at brut.androlib.Androlib.build(Androlib.java:174) at brut.apktool.Main.cmdBuild(Main.java:188) at brut.apktool.Main.main(Main.java:70) Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL3418222472327622786.tmp, -I, /home/.../.../framework/1.apk, -S, /home/.../.../res, -M, /home/.../.../AndroidManifest.xml] at brut.util.OS.exec(OS.java:87) at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253) ... 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.(UNIXProcess.java:164) at java.lang.ProcessImpl.start(ProcessImpl.java:81) at java.lang.ProcessBuilder.start(ProcessBuilder.java:468) ... 10 more
It seems like a PATH problem because it can't access aapt however my PATH is located in ~/pam_enviorment and is the following:
PATH DEFAULT=${PATH}:~/myTerminal
PATH DEFAULT=${PATH}:~/myTerminal/aaptAny constructive feedback is welcomed.
2 Answers
As of apktool v1.5.1 I added support for passing the path to apktool via --aapt/-a, so on rebuild just use apktool b --aapt /path/to/aapt nameofapkfolder. So update your apktool and forget messing around with path variables.
As for the path problem. What happens on echo $PATH?
It definitely seems like the aapt PATH problem I had a while back. I'm sure you have this all sorted out by now, but for other Linux users who may have the same problem, I have made a good apk kit in bash to avoid all these dependency problems called apk munky-rench. Check it out.
At initial release, apk munky-rench has the following features:
- Unzip Apk
- Zip APK
- Install Frameworks
- Decompile Apk
- Compile Apk
- Sign Apk
- Zipalign Apk
- Compile System Apk
- ADB Install
- ADB Push/Pull
- Fastboot Flash Recovery
- Heimdall Flash Recovery
- Supports Samsung devices through onboard Heimdall
- Flashable Zip Generator
- Lollipop Compatibility
- Brief Explanations of Features