1. You want that $100.00 in your pocket or an Amazon Fire TV don't you? Well here's the deal. With our new updated look we are in desperate need of an updated logo. The 'old' one has certainly served us well, but it's time. Find all the details here: bit.ly/1q0k6Wa
  2. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

apktool.jar help!!!

Discussion in 'Android Hacks and Help' started by thebowers, Jul 9, 2010.

  1. thebowers
    Offline

    thebowers Premium Member Theme Developer Premium Member

    Joined:
    Nov 24, 2009
    Messages:
    2,548
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    I would really like to get this to work. It opens so many things (hate having to use HxD and axmlprinter.jar, when I could just use this with plain xml).

    Anyway I can decompile the .apk just fine but can never get it to recompile. I get these errors below.

    Code:
     
    D:\>java -jar apktool.jar b twitter
    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, D:\Users\THEBOW~1\AppData\Local\Temp\APKTOOL6666141519779796787.tmp, -I, D:\Users\THEBOW~1\AppData\Local\Temp\brut_util_Jar_7251183562717733225.tmp, -I, D:\Users\THEBOW~1\AppData\Local\Temp\brut_util_Jar_5111289146222151494.tmp, -S, D:\\twitter\res, -M, D:\\twitter\AndroidManifest.xml, D:\\twitter\9patch]
            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, D:\Users\THEBOW~1\AppData\Local\Temp\APKTOOL6666141519779796787.tmp, -I, D:\Users\THEBOW~1\AppData\Local\Temp\brut_util_Jar_7251183562717733225.tmp, -I, D:\Users\THEBOW~1\AppData\Local\Temp\brut_util_Jar_5111289146222151494.tmp, -S, D:\\twitter\res, -M, D:\\twitter\AndroidManifest.xml, D:\\twitter\9patch]
            at brut.util.OS.exec(Unknown Source)
            ... 7 more
    Caused by: java.io.IOException: Cannot run program "aapt": CreateProcess error=2, The system cannot find the file specified
            at java.lang.ProcessBuilder.start(Unknown Source)
            at java.lang.Runtime.exec(Unknown Source)
            at java.lang.Runtime.exec(Unknown Source)
            ... 8 more
    Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
            at java.lang.ProcessImpl.create(Native Method)
            at java.lang.ProcessImpl.<init>(Unknown Source)
            at java.lang.ProcessImpl.start(Unknown Source)
            ... 11 more
    D:\>
    
    I get this even if I just simply decompile and recompile. So, anyone know what the errors mean and how to fix it. I am on Vista 32-bit. I have tried this on two different hard drives with the same result.
  2. raidzero
    Offline

    raidzero n00b. Theme Developer Premium Member Developer

    Joined:
    Apr 15, 2010
    Messages:
    1,054
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Denver, CO
    do you have the version of aapt.exe that came with apktoo..jar in your path?
  3. thebowers
    Offline

    thebowers Premium Member Theme Developer Premium Member

    Joined:
    Nov 24, 2009
    Messages:
    2,548
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    Don't know that I follow what you are saying. I only do two commands with apktool.jar

    java -jar apktool.jar d <whatever.apk> <whatever>
    java -jar apktool.jar b <whatever>
  4. raidzero
    Offline

    raidzero n00b. Theme Developer Premium Member Developer

    Joined:
    Apr 15, 2010
    Messages:
    1,054
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Denver, CO

    it relies on aapt.exe, put it in a dir in your PATH environment variable in windows.

    I prefer the batch file... android-apktool - Project Hosting on Google Code
  5. thebowers
    Offline

    thebowers Premium Member Theme Developer Premium Member

    Joined:
    Nov 24, 2009
    Messages:
    2,548
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    Ok I got the apktool.bat and aapt.exe files what else do I need to do from here? Can you explain the process as if I don't know a clue...lol
  6. raidzero
    Offline

    raidzero n00b. Theme Developer Premium Member Developer

    Joined:
    Apr 15, 2010
    Messages:
    1,054
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Denver, CO
    if you have the android sdk installed (adb) then the android-sdk-windows\tools directory may already be in your path. if that is the case simply drop the apktool stuff and aapt into the android-sdk-windows\tools directory, overwriting the current aapt.exe

    that way you can run apktool globally.. I put all my android tools in that directory for simplicity's sake
    Code:
    c:\anywhere\apk> apktool d something.apk something_decompiled
    
    long story short, just put the jar, the bat, and aapt.exe in the sdk tools directory
  7. thebowers
    Offline

    thebowers Premium Member Theme Developer Premium Member

    Joined:
    Nov 24, 2009
    Messages:
    2,548
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    I get that, can you tell me where you add PATH enviroment variables. I can't remember that process.

    Edit: I didn't have an aapt.exe in the tools directory before
    Last edited: Jul 9, 2010
  8. raidzero
    Offline

    raidzero n00b. Theme Developer Premium Member Developer

    Joined:
    Apr 15, 2010
    Messages:
    1,054
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Denver, CO
    start>right click computer>properties>advanced system settings>advanced>environment variables

    heres mine:

    [​IMG]
  9. thebowers
    Offline

    thebowers Premium Member Theme Developer Premium Member

    Joined:
    Nov 24, 2009
    Messages:
    2,548
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    Just to make sure you full path would be to the aapt.exe file, correct?

    :%path%:\android\tools\aapt.exe would be my example.
    Last edited: Jul 9, 2010
  10. raidzero
    Offline

    raidzero n00b. Theme Developer Premium Member Developer

    Joined:
    Apr 15, 2010
    Messages:
    1,054
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Denver, CO
    no, just :%path%:\android\tools

    the path is a list of locations that the system looks for when commands are given. By adding this location, windows knows where to look for the executables when it doesnt find then in the rest of its normal places (c:\windows, c:\windows\system32, etc)

    add directories to the path to put executables in them that you want to access from any location.

    if you wanted to be real unclean you could just put aapt, apktool.jar and apktool.bat in c:\windows\system32

    but its better IMO to keep your apps in their own directory, just makes for a cleaner environment.
  11. thebowers
    Offline

    thebowers Premium Member Theme Developer Premium Member

    Joined:
    Nov 24, 2009
    Messages:
    2,548
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    Thank you very much, up and working now.
  12. raidzero
    Offline

    raidzero n00b. Theme Developer Premium Member Developer

    Joined:
    Apr 15, 2010
    Messages:
    1,054
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Denver, CO
    congrats!

    The latest version of apktool rocks. It decompiles .9's and xml correctly so that they can be edited directly and then it can recompile without issues :)
  13. kevdog
    Offline

    kevdog New Member

    Joined:
    Nov 14, 2009
    Messages:
    722
    Likes Received:
    0
    Trophy Points:
    0
    Any tips how to use this lovely tool?
  14. vanitha
    Offline

    vanitha New Member

    Joined:
    Jan 19, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I'm new to android and linux, I downloaded a free android apk file and when I tried to load it in eclipse, I got an error saying the xml file cannot be parsed, a bit searching for this error on the net led me to the apktool, however when I run this tool, following all the instructions, I get the following error
    apktool d -f BlueFTP.apk_FILES
    Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
    at brut.androlib.ApkDecoder.hasSources(Unknown Source)
    at brut.androlib.ApkDecoder.decode(Unknown Source)
    at brut.apktool.Main.cmdDecode(Unknown Source)
    at brut.apktool.Main.main(Unknown Source)
    Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
    at brut.directory.ZipRODirectory.<init>(Unknown Source)
    at brut.directory.ZipRODirectory.<init>(Unknown Source)
    at brut.androlib.res.util.ExtFile.getDirectory(Unknown Source)
    ... 4 more
    Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:131)
    at java.util.zip.ZipFile.<init>(ZipFile.java:148)
    ... 7 more

    Could you please help me ?
Similar Threads
  1. mgarney26
    Replies:
    3
    Views:
    468
  2. JnnNicole
    Replies:
    1
    Views:
    425
  3. kees.5
    Replies:
    2
    Views:
    976
  4. ehreeahna29
    Replies:
    7
    Views:
    731
  5. jwdechert
    Replies:
    1
    Views:
    3,341
Loading...
Search tags for this page

aapt command in a path

,
aapt command in a path windows
,
aapt command in path
,
aapt path
,
apktool error in opening zip file
,
apktool exception in thread main brut.androlib.androlibexcep
,
brut.androlib.androlibexception: brut.directory.directoryexc
,
brut.directory.directoryexception: java.util.zip.zipexceptio
,

can't find apktool.jar

,

cannot run program aapt

,
cannot run program aapt: createprocess error=2
,
caused by: brut.common.brutexception: could not exec command
,

exception in thread main brut.androlib.androlibexception: br

,
java.util.zip.zipexception: error in opening zip file apktoo
,
s4 apktool errors