linux(64位) 环境下 apktool运行问题

linux(64位) 环境下 apktool运行问题

一直以来都是在windows环境下部署的apktool反向工程环境,最近公司需求,需要将此环境配置到服务器上(linux 64位)。反向解包的时候没有问题,重新压包的时候报出一下错误。几经波折,终于找到了原因,跟大家分享一下。

apktool b xxxxxx
I: Using Apktool 2.0.2
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_4724925685454536622.tmp, p, --forced-package-id, 127,………………过长省略……………………/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:465)
    at brut.androlib.Androlib.buildResources(Androlib.java:403)
    at brut.androlib.Androlib.build(Androlib.java:291)
    at brut.androlib.Androlib.build(Androlib.java:261)
    at brut.apktool.Main.cmdBuild(Main.java:225)
    at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_4724925685454536622.tmp,……………过长省略……………/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:451)
    ... 5 more
Caused by: brut.common.BrutException: could not exec command: [/tmp/brut_util_Jar_4724925685454536622.tmp,……………过长省略……………AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:93)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
    ... 6 more
Caused by: java.io.IOException: Cannot run program "/tmp/brut_util_Jar_4724925685454536622.tmp": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at java.lang.Runtime.exec(Runtime.java:485)
    at brut.util.OS.exec(OS.java:84)
    ... 7 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:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 10 more

根据官方文档提示:apktool安装文档
这里写图片描述
apktool在linux系统上运行需要提供32位的编译环境。所以就需要在64的linux上安装32位的glibc、zlib、libstdc++

执行:

yum update libstdc++
yum install libstdc++.i686 glibc.i686 zlib.i686

ok,问题解决,如果更换apktool.jar,需要前往 cd apktool/framework/ 删除掉:1.apk重现运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值