apktool构建apk失败 [英] apktool build apk fails
问题描述
我遇到了有关应用程序apktool问题的非常烦人的问题.我不明白我在做什么错,或者是什么问题.我在debian和Linux mint上尝试过此方法.我使用了不同版本的apktool,
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,
导致相同的错误:
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
似乎不能使用aapt,但是我阅读了有关apktool的信息.而且似乎aapt是内置在apktool中的,为什么它不起作用?
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 ?
推荐答案
似乎在重新编译apk时构建资源时存在一些问题.您可以做的是,当您反编译apk时,请使用以下命令
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
这里-f替换先前反编译的apk的代码,-r忽略资源的反编译.
here -f is to replace previous decompiled apk's code and -r is to ignore the decompiling of resources.
这将防止资源被反编译,并且在重新编译apk时仅复制相同的资源.
this would prevent the resources from being decompiled and will simply copy the same resources when you recompile the apk.
这篇关于apktool构建apk失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!