5

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.

$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

eskoba
  • 532
  • 1
  • 7
  • 25
  • 1
    `Cannot run program "aapt": java.io.IOException: error=2, No such file or directory` - that's a start... I don't know much about this JAR/APK to tell you anything else, but make sure that file exists. – Makoto Aug 08 '13 at 05:10
  • yes but what I don't understand is why it is happening. apktool is proven to work without any problem (obvious except in my case). and this error is coming from the apktool jar file. – eskoba Aug 08 '13 at 05:18
  • Duplicate of [recompile - apktool build apk fails - Stack Overflow](https://stackoverflow.com/questions/23317208/apktool-build-apk-fails) – user202729 Dec 15 '20 at 05:37

3 Answers3

1

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

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

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

Michael Litvin
  • 3,976
  • 1
  • 34
  • 40
  • There is no apk in that folder! – Dr.jacky Mar 13 '16 at 14:31
  • I tryed this and it regenerated a `1.apk` file. Also if I run `apktool if file.apk` it generates a `127.apk` but when decompile stills uses the 1.apk – Fnr Mar 13 '17 at 00:59
0

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

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

Igor Čordaš
  • 5,785
  • 4
  • 42
  • 54
0

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

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 :)