[SOLVED] Trying, and failing, to compile edited and stock APKs

Jimieo

Well-known member
Feb 12, 2012
80
2
0
Visit site
Okay, I have been all over XDA reading about hacks, roms, tweaks and what not. I have been following a guide on editing the SystemUI.apk but I ran into trouble compiling it. I read somewhere that one can not decompile and recompile an already edited/themed APK. However someone else tested the APKs I was working on and confirmed it worked for him. So I have no idea what I am missing.

It decompiles flawlessly. The problem arrises when I move to compile them again. This happens on stock and themed APKs... Here is my command log for the most recent attempt

Code:
J:\apktools>apktool if framework-res.apk
I: Framework installed to: C:\Users\Jimie\apktool\framework\1.apk

J:\apktools>apktool d SystemUI.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Jimie\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

J:\apktools>apktool b SystemUI
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.BrutExce
ption: could not exec command: [aapt, p, -F, C:\Users\Jimie\AppData\Local\Temp\A
PKTOOL8713681568342440015.tmp, -I, C:\Users\Jimie\apktool\framework\1.apk, -S, J
:\apktools\SystemUI\res, -M, J:\apktools\SystemUI\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a: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:182)
        at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\U
sers\Jimie\AppData\Local\Temp\APKTOOL8713681568342440015.tmp, -I, C:\Users\Jimie
\apktool\framework\1.apk, -S, J:\apktools\SystemUI\res, -M, J:\apktools\SystemUI
\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:87)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:191)
        ... 6 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)
        at brut.util.OS.exec(OS.java:78)
        ... 7 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e 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

J:\apktools>

The people I've spoken to at XDA are stumped. I had wondered if it was something else I had installed that was conflicting with something, so I just did a factory restore. Installed Chrome, and Java. No dice.


UPDATE: it was a stupid mistake on my part. A bit of time away from the project and I saw my mistake.
 
Last edited:

Jimieo

Well-known member
Feb 12, 2012
80
2
0
Visit site
Re: Trying, and failing, to compile edited and stock APKs

Oh, I forgot I made this thread. Thank you, but I have gotten it sorted out. :D
 

Jimieo

Well-known member
Feb 12, 2012
80
2
0
Visit site
Re: [SOLVED] Trying, and failing, to compile edited and stock APK

It was a dump mistake. I was trying to edit the ICS Domination theme for Sprint .There are a few corrupted .9.png images in the theme. Apktool would keep the corrupted ones and make a copy renamed to .png

I was just replacing the corrupted ones.. NOT removing the renamed .png ones. After I got rid of them, it was all good.
 

Paul627g

AC Moderator All-Star
Moderator
Nov 25, 2010
15,963
2,752
0
Visit site
Re: [SOLVED] Trying, and failing, to compile edited and stock APK

It was a dump mistake. I was trying to edit the ICS Domination theme for Sprint .There are a few corrupted .9.png images in the theme. Apktool would keep the corrupted ones and make a copy renamed to .png

I was just replacing the corrupted ones.. NOT removing the renamed .png ones. After I got rid of them, it was all good.

First thing to always check when you have a failed recompile of a previously modified apk is corrupted .9.png's

That will blow the recompile every time ;) Most common signs or warning flags of a problem previously modified apk is when someone has slipped in modified .9.pngs into the "apk" or zip file without decompiling and recompiling the apks with the new .9.pngs in place.. I call this a "dirty mod" just like the term "dirty flash".

We learned this didn't we Ziggy?
 

ZiggSVO

Well-known member
Jun 7, 2010
396
52
0
Visit site
First thing to always check when you have a failed recompile of a previously modified apk is corrupted .9.png's

That will blow the recompile every time ;) Most common signs or warning flags of a problem previously modified apk is when someone has slipped in modified .9.pngs into the "apk" or zip file without decompiling and recompiling the apks with the new .9.pngs in place.. I call this a "dirty mod" just like the term "dirty flash".

We learned this didn't we Ziggy?

Yes yes we did. Always double check your work and triple check someone else lol

Sent from my SGH-I747 using Tapatalk 2