Java 我如何解决 brut.androlib.AndrolibException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18109690/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 22:27:07  来源:igfitidea点击:

how do I solve the brut.androlib.AndrolibException

javaandroiddebuggingapk

提问by eskoba

I am having the following exception after decoding the apk in debug mode and trying to build a new apk in debug mode. I am confused and I don't what to do. when I try the following I am getting exactly the same result.

在调试模式下解码 apk 并尝试在调试模式下构建新的 apk 后,我遇到以下异常。我很困惑,我不知道该怎么办。当我尝试以下操作时,我得到了完全相同的结果。

$java -jar ./apktool.jar d -d meet.apk out
$java -jar ./apktool.jar b -d out meet.apk

or this

或这个

$./apktool d -d meet.apk out
$./apktool b -d out meet.apk

I get the following output

我得到以下输出

I: Checking whether sources has changed...
I: Smaling...
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/APKTOOL4160944918573250929.tmp, -I, /root/apktool/framework/1.apk, -S, /home/lab2alex/Documents/out/res, -M, /home/lab2alex/Documents/out/AndroidManifest.xml]
  at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL4160944918573250929.tmp, -I, /root/apktool/framework/1.apk, -S, /home/lab2alex/Documents/out/res, -M, /home/lab2alex/Documents/out/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:87)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 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:488)
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.<init>(UNIXProcess.java:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
... 10 more

what should I do

我该怎么办

回答by Igor ?orda?

This was First check that you are using latest version of aapt. Second check that you are using latest version of apktool this beta is totally fine http://connortumbleson.com/2013/10/apktool-2-0-0-beta-7-released/Third check that you are using correct version of java. Forth and possibly solution for your problem on some Distros of Linux you will need these libs: glibc zlib libstdc++47

这是首先检查您是否使用最新版本的 aapt。第二次检查您使用的是最新版本的 apktool 这个测试版完全没问题http://connortumbleson.com/2013/10/apktool-2-0-0-beta-7-released/第三次检查您使用的是正确版本的爪哇。对于您在某些 Linux 发行版上的问题的第四个可能的解决方案,您将需要这些库:glibc zlib libstdc++47

Fifth ALWAYS supply --frame-path and set it to something where you have correct permission.

第五,始终提供 --frame-path 并将其设置为您拥有正确权限的内容。

回答by Michael Litvin

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

如果您一直在使用 v1 而现在升级到 v2,请尝试手动删除框架文件。

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

在 Windows 8 上,它通常在C:\Users\YourName\apktool\framework\1.apk.

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

一旦您尝试构建某些东西,就应该重新生成该文件。

回答by Pushkar Shrivastava

Try using latest version of apktool. Sometimes opening command prompt with run as administrator can do the job.But Later on i am stuck with this kind of code

尝试使用最新版本的 apktool。有时以管理员身份打开命令提示符可以完成这项工作。但后来我被这种代码困住了

protected void onCreate(android.os.Bundle paramBundle)
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_2
    //   2: aload_0
    //   3: aload_1
    //   4: invokespecial 755   ****/***/***/c:onCreate (Landroid/os/Bundle;)V
    //   7: aload_0
    //   8: invokevirtual 759   ****/***/***/:getApplicationContext ()Landroid/content/Context;
    //   11: invokestatic 764   com/facebook/accountkit/AccountKit:initialize   (Landroid/content/Context;)V
    //   14: invokestatic 201   ****/***/***/e:a    ()****/***/***/e;
    //   17: invokevirtual 766  ****/***/***/e:b    ()I
    //   20: istore 14
    //   22: iload 14
    //   24: ifle +13 -> 37
    //   27: iload 14
..............
}

***/***/**represents package path which can disclose what i am trying to decode :)

***/***/**代表包路径,它可以透露我正在尝试解码的内容:)