apktool.jar help!!!

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,547
Reaction score
1
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.
 

raidzero

n00b.
Premium Member
Developer
Theme Developer
Joined
Apr 15, 2010
Messages
1,054
Reaction score
3
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.

do you have the version of aapt.exe that came with apktoo..jar in your path?
 
OP
thebowers

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,547
Reaction score
1
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>
 
OP
thebowers

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,547
Reaction score
1
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
 

raidzero

n00b.
Premium Member
Developer
Theme Developer
Joined
Apr 15, 2010
Messages
1,054
Reaction score
3
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

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
 
OP
thebowers

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,547
Reaction score
1
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:

raidzero

n00b.
Premium Member
Developer
Theme Developer
Joined
Apr 15, 2010
Messages
1,054
Reaction score
3
I get that, can you tell me where you add PATH enviroment variables. I can't remember that process.
start>right click computer>properties>advanced system settings>advanced>environment variables

heres mine:

2zog7yv.jpg
 
OP
thebowers

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,547
Reaction score
1
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:

raidzero

n00b.
Premium Member
Developer
Theme Developer
Joined
Apr 15, 2010
Messages
1,054
Reaction score
3
Just to make sure you full path would be to the aapt.exe file, correct?

:%path%:\android\tools\aapt.exe would be my example.

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.
 
OP
thebowers

thebowers

Premium Member
Premium Member
Theme Developer
Joined
Nov 24, 2009
Messages
2,547
Reaction score
1
Location
Iowa
Thank you very much, up and working now.
 

raidzero

n00b.
Premium Member
Developer
Theme Developer
Joined
Apr 15, 2010
Messages
1,054
Reaction score
3
Thank you very much, up and working now.

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

vanitha

New Member
Joined
Jan 19, 2011
Messages
1
Reaction score
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 ?
 
Top