apktool 构建 apk 失败 [英] apktool build apk fails

查看:55
本文介绍了apktool 构建 apk 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了非常烦人的应用程序 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆