[Guide] Decompile with Apk Tool [Easy Way]

Search This thread

bigpappags3

Senior Member
May 19, 2013
1,374
2,825
0
Dalla/Ft.Worth
No system file

I downloaded the zip. Extracted the zip. I noticed that there were only three files in the zip as compared to the fourth named system. Making sure that this is correct before I continue. :good: in advance.
 

shreddintyres

Senior Member
Aug 25, 2010
1,530
562
0
Richardson, Tx
I'm having some issues here. I am unable to successfully recompile applications. I am able to successfully decompile but recompiling gives me issues, in the below I am attempting to recompile an unmodified apk from its decompiled apk moments after i had decompiled it.

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

C:\apktool>apktool d -f Gallery2.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\AUSQ\apktool\framework\1.apk
I: Loaded.
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...

C:\apktool>apktool b Gallery2 newGallery2.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
C:\apktool\Gallery2\res\values\styles.xml:148: error: Error retrieving parent for item: No resource found that matches t
he given name 'TextAppearance'.
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException:
could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 16, -F, C:\Users\AUSQ\AppData\Local\Temp\
APKTOOL7808385171331998377.tmp, -0, arsc, -I, C:\Users\AUSQ\apktool\framework\1.apk, -S, C:\apktool\Gallery2\res, -M, C:
\apktool\Gallery2\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:353)
        at brut.androlib.Androlib.buildResources(Androlib.java:281)
        at brut.androlib.Androlib.build(Androlib.java:209)
        at brut.androlib.Androlib.build(Androlib.java:177)
        at brut.apktool.Main.cmdBuild(Main.java:237)
        at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-versi
on, 10, --target-sdk-version, 16, -F, C:\Users\AUSQ\AppData\Local\Temp\APKTOOL7808385171331998377.tmp, -0, arsc, -I, C:\
Users\AUSQ\apktool\framework\1.apk, -S, C:\apktool\Gallery2\res, -M, C:\apktool\Gallery2\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:406)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:334)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 16,
 -F, C:\Users\AUSQ\AppData\Local\Temp\APKTOOL7808385171331998377.tmp, -0, arsc, -I, C:\Users\AUSQ\apktool\framework\1.ap
k, -S, C:\apktool\Gallery2\res, -M, C:\apktool\Gallery2\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:404)
        ... 6 more


		
// try loading modified aapt manually

C:\apktool> apktool b --aapt C:\apktool\aapt.exe Gallery2 test.apk
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
C:\apktool\Gallery2\res\values\styles.xml:148: error: Error retrieving parent for item: No resource found that matches t
he given name 'TextAppearance'.
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException:
could not exec command: [C:\apktool\aapt.exe, p, --min-sdk-version, 10, --target-sdk-version, 16, -F, C:\Users\AUSQ\AppD
ata\Local\Temp\APKTOOL2712698154664871659.tmp, -0, arsc, -I, C:\Users\AUSQ\apktool\framework\1.apk, -S, C:\apktool\Galle
ry2\res, -M, C:\apktool\Gallery2\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:353)
        at brut.androlib.Androlib.buildResources(Androlib.java:281)
        at brut.androlib.Androlib.build(Androlib.java:209)
        at brut.androlib.Androlib.build(Androlib.java:177)
        at brut.apktool.Main.cmdBuild(Main.java:237)
        at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [C:\apktool\aapt.exe, p,
--min-sdk-version, 10, --target-sdk-version, 16, -F, C:\Users\AUSQ\AppData\Local\Temp\APKTOOL2712698154664871659.tmp, -0
, arsc, -I, C:\Users\AUSQ\apktool\framework\1.apk, -S, C:\apktool\Gallery2\res, -M, C:\apktool\Gallery2\AndroidManifest.
xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:406)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:334)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [C:\apktool\aapt.exe, p, --min-sdk-version, 10, --target-s
dk-version, 16, -F, C:\Users\AUSQ\AppData\Local\Temp\APKTOOL2712698154664871659.tmp, -0, arsc, -I, C:\Users\AUSQ\apktool
\framework\1.apk, -S, C:\apktool\Gallery2\res, -M, C:\apktool\Gallery2\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:404)
        ... 6 more

I am using a modified aapt.exe which is needed for Slimbean and anyother roms with TRDS, otherwise I have the latest version of JAVA JRE and JDK and Android SDK as well as JAVA and JRE 6 u45

I would greatly appreciate any help. Thank you in advance.
 
Last edited:

welard

Senior Member
May 5, 2009
297
14
0
hi all as anyone solved this problem im having >>>>>>

W: cant find 9patch chunk in file......renaming to *png.

buy the way its unmodified apk from a s4 dump....the apk is (S-Voice_Android_phone_J.apk)....

can anyone pull that apk and give it a try and let me know what results you get thanks..
 

shaider_516

Senior Member
Dec 22, 2010
320
23
0
Quezon City
im having this error from CM10.1 for nexus 4.

reinstalled java, other APKs working but not form framework-res.apk

C:\Android\apktool2>apktool if "framework-res.apk"
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources:
spec=0x01080295 drawable/ic_ab_back_holo_dark, config=-xhdpi
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)

at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165
)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
5)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:39)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:384)
at brut.androlib.Androlib.installFramework(Androlib.java:365)
at brut.apktool.Main.cmdInstallFramework(Main.java:193)
at brut.apktool.Main.main(Main.java:69)

C:\Android\apktool2>
 
Last edited:

Febrilian

New member
Mar 28, 2013
4
0
0
What should I do with this? Is this java error?

Code:
C:\apktool>apktool d systemui.apk systemui1
I: Baksmaling...
Exception in thread "main" java.lang.RuntimeException: bad magic value: 64 65 78
 0a 30 33 36 00
        at org.jf.dexlib.DexFile.<init>(DexFile.java:377)
        at org.jf.dexlib.DexFile.<init>(DexFile.java:274)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:44)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:33)
        at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:68)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:85)
        at brut.apktool.Main.cmdDecode(Main.java:128)
        at brut.apktool.Main.main(Main.java:65)
 

js2892

Senior Member
Jul 28, 2012
660
387
0
Bangalore
i decompiled my Calendar.apk properly.
Now i edited an xml in "Values" folder but when i open the apk through winrar, there is no "values" folder. So how can i replace the edited xml?
 

sudhir.cd

Member
Nov 6, 2011
25
1
0
Hello

Thanks a lot for gr8 info u provided....

I tried to recompile systemUI.apk but after recompilation, file size was become less and after installing systemui on mobile it was not working properly ......Any Help

Thanks in Advance:good::good:
 

js2892

Senior Member
Jul 28, 2012
660
387
0
Bangalore
Recompile the calender.apk you decompiled then use 7zip to replace the file

Sent from my HTC Desire X

i think u didn't understand.
When i open .apk with 7zip, the folder which i edited(after decompiling) is not present.

---------- Post added at 02:36 PM ---------- Previous post was at 02:35 PM ----------

Thanks a lot for gr8 info u provided....

I tried to recompile systemUI.apk but after recompilation, file size was become less and after installing systemui on mobile it was not working properly ......Any Help

Thanks in Advance:good::good:

the file size reduces, no problem in that.
Did you set the correct permission while replacing as rw,r,r?
 

sudhir.cd

Member
Nov 6, 2011
25
1
0
Re:Error

yes sir, i set the proper permission. I just decompile n recompile SystemUI.apk for trial but after using that apk, my notification bar n wall paper gone... :(



---------- Post added at 02:36 PM ---------- Previous post was at 02:35 PM ----------

[/COLOR]

the file size reduces, no problem in that.
Did you set the correct permission while replacing as rw,r,r?
 

erikalin

Senior Member
Sep 4, 2012
1,062
2,906
0
Twin Cities, Mini Soda USA
i think u didn't understand.
When i open .apk with 7zip, the folder which i edited(after decompiling) is not present.


This is a late reply, so you might have figured this out. I'm replying in case you haven't yet. ;) Basically, you are correct that you will not be able to see the VALUES folder in your recompiled sec calendar apk. It's there, but you can't see it unless you decompile again to take a peek. You'll have to just copy the entire RES folder. The VALUES folder is inside, I promise. Good luck, bud. :good: You'll have fun with this once the kinks get ironed out.
 
  • Like
Reactions: js2892 and notrium

eternitys

Senior Member
May 26, 2009
567
123
73
Gujarat, India
Could you please help on this error.

Untitled.jpg
 

Top Liked Posts

  • There are no posts matching your filters.
  • 177


    ## Due to exams I won't be able to reply on questions, there are however many experienced developers active on this thread like @SpaceCaker & @K.A. ##

    I have seen a lot of guides on how to decompile with Apk Tool, but none are noob friendly, so I thought I would post this.

    What You Need:

    ApkTool
    Java JDK/JRE 32 bit
    Super Basic Cmd/terminal knowledge (My 5 year old brother can handle this)



    Download Apk Tool Here: (Must be this one)

    Mega

    First you need to extract that zip folder to anywhere you choose, preferably on root of c/drive E.g: C:/android/apktool extracting the files to 'apktool' folder.

    Now copy the apk you would like to mod into your Apk Tool folder.

    f6f8ecf510f10ce4c2c308a5f8a0ea7b.jpg



    Command Prompt:

    Open up your Command Prompt by going to:
    Start -> run -> type : Cmd

    32013a151ec069c5099725789edc10ac.jpg


    Code:
    Your cmd will probly look like this..
    
    C:\users\yourname>
    
    so type in
    
    cd.. [COLOR="Red"](Yes include the '..' and press enter after you type each command.)[/COLOR]
    
    this will get you to back directory so now you will see
    
    C:\users>
    
    so type again
    
    cd..
    
    you should now see this:
    
    C:\>
    
    now type in:
    
    cd 'apktoo'l/'directory'
    
    for me it looks like:
    
    cd android/apktool
    
    now you should see:
    
    C:/android/apktool>
    
    and you are in the apktool directory

    dd6f52dd0a63e9cfec11257816610e7e.jpg



    Installing Framework:

    Now that you are in directory we need to install the device's framework to your system for it to compile correctly so type this:

    apktool if framework-res.apk

    Remember: Devices like HTC / Samsung / Huawei have other frameworks that are used in their apps too, sometimes you need to install them too.

    This will install the devices framework to your system. (need to do this)

    0469af0a4f59683b5afd65bbaa517560.jpg


    Decompiling:

    Now to decompile the apk you want to edit, type this:

    apktool d framework-res.apk framework1

    or

    apktool d music.apk music

    music.apk is the apk your decompiling
    music is the folder you're creating for the decompiled apk

    Now go about your business :victory:

    66f044a6c2f13780fcc0fc4b7cb664dc.jpg


    3b486e7ae9e032f8eb4bab257abafe7f.jpg



    Recompiling/Finished Product:


    Now to recompile your new apk type this:

    apktool b music music-new.apk

    or

    apktool b framework1 framework-res-new.apk

    framework1 is the folder with your edited files
    framework-res-new.apk is your new apk file

    131ce3032fc2e7ca4371de574ebec108.jpg


    16f0361f73797450f7af2457791b36fd.jpg



    We are NOT done just yet, we cannot use the new apk's... we have to take what we did and add it back to the original apk file to keep proper signature

    use something like 7zip, take the 'resources.arcs' file and any other xml files you edited out of the "-new" apk and copy them into Original apk

    Your new modded APK is now ready, Congrats! :highfive:

    If you get Java errors see here.
    If you recompile fine but doesn't install " App couldn't not be installed " see here.
    Good Luck Guys! :fingers-crossed:

    11
    Fix a corrupted Java Jre ( Development package )

    • Download JavaRa




    • Run with Administrator permissions

    • Click Remove Java Runtime

    ex5FCGf.png


    • Click on Additional Tasks

    CKCvO2t.png


    • Select the following and click Run

    HkBLp3U.png


    ( Remove Startup Entry, Remove Outdated JRE Firefox Extensions, Clean JRE Temp Files. )

    • Re-install from here:



    Note that JavaRA might have updated and has onscreen instructions to help you fix your JRE.

    4
    AFAIK, for systemUI, you need to replace resources.arsc, classes.dex and the res folder..
    Nicely done, btw..
    3
    Has the APK been signed? If not, see Here.
    3
    can u share your apktool stuff ?



    Sent from my ST25i using xda premium
    The aapt file, the apktool jar and apktool file? That only, right?

    ---------- Post added at 11:57 PM ---------- Previous post was at 11:53 PM ----------

    http://www.mediafire.com/?b4au2n8pz1e153p
    This is the 3 files i put..in C:\Windows...
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone