[GUIDE] How to use APKTOOL

Search This thread

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
Okk i have a sony xperia device running on jb4.2.2

when i try to recompile frameworks res apk
after making minor modifications i get the error

No known package when getting files for resource no (some no.)

Plzz help me
I have already loaded all required files in apktool and tried latest versions

Sent from my C2305 using Tapatalk

Can you recompile it without any modifications done
If yes then it's your mod - can't help you with that

If no its either improper use of apktool or incorrectly installed


Also latest versions are for KitKat/lollipop
If using jellybean files I would remain on version 1.5.2
 

abhishekr700

Senior Member
Mar 20, 2013
1,213
763
New Delhi
www.geeksunboxed.com
Can you recompile it without any modifications done
If yes then it's your mod - can't help you with that

If no its either improper use of apktool or incorrectly installed


Also latest versions are for KitKat/lollipop
If using jellybean files I would remain on version 1.5.2
when i use 1.5 version I always stuck in bootloop
Phone boots anly on 2.0 rc3/rc4

I tried without any mods but still i get the same error
Also i forgot to mention that these come as warnings and the apk file builds but there is a serious problem

The backgground which used to be a textured one comes completly black and when i scrioll through settings menu the sceen gets completely distorted
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
when i use 1.5 version I always stuck in bootloop
Phone boots anly on 2.0 rc3/rc4

I tried without any mods but still i get the same error
Also i forgot to mention that these come as warnings and the apk file builds but there is a serious problem

The backgground which used to be a textured one comes completly black and when i scrioll through settings menu the sceen gets completely distorted

Warnings are normal - especially if they are translation warnings in framework

If it doesn't recompile without any modifications you are using either the wrong version of apktool or wrong framework
1.5.2 is the version to use for jellybean & below
2 rc3/4 is for KitKat & lollipop

The bootloop has nothing to do with apktool - Most likely incorrect modification or you are modding framework and will therefore need to data wipe after flashing especially if you are using mods like link2sd
 

abhishekr700

Senior Member
Mar 20, 2013
1,213
763
New Delhi
www.geeksunboxed.com
Warnings are normal - especially if they are translation warnings in framework

If it doesn't recompile without any modifications you are using either the wrong version of apktool or wrong framework
1.5.2 is the version to use for jellybean & below
2 rc3/4 is for KitKat & lollipop

The bootloop has nothing to do with apktool - Most likely incorrect modification or you are modding framework and will therefore need to data wipe after flashing especially if you are using mods like link2sd

I know translation warning are useless

But the warning im getting is something else as i told u

No known package when getting flags for resource no (some no.)

You know this is very important warning
And comes on rc3/4
But u said they are not for jb so i will try with 1.5 but i have tried many timee before with them
They dont give such warning and build apk
But it gives me bootloop

I dont have link2sd or anything else and compiling without mods

Sent from my C2305 using Tapatalk
 

Attachments

  • uploadfromtaptalk1425302073516.png
    uploadfromtaptalk1425302073516.png
    47.4 KB · Views: 56
  • uploadfromtaptalk1425302085077.png
    uploadfromtaptalk1425302085077.png
    97.2 KB · Views: 52
  • uploadfromtaptalk1425302094162.jpg
    uploadfromtaptalk1425302094162.jpg
    114.1 KB · Views: 52

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
I know translation warning are useless

But the warning im getting is something else as i told u

No known package when getting flags for resource no (some no.)

You know this is very important warning
And comes on rc3/4
But u said they are not for jb so i will try with 1.5 but i have tried many timee before with them
They dont give such warning and build apk
But it gives me bootloop

I dont have link2sd or anything else and compiling without mods

Sent from my C2305 using Tapatalk


Just because the apk recompile doesn't mean the mod has been done correctly - it just means there are no syntax errors

For example

You can have a smali file with a value that points to 0x965236 in public.xml

But if this value is wrong or relates to something else than it will cause a bootloop either on startup or when that reference is activated eg a button press


Can't help you any other way - my guess is incorrect modification - logcat it & find out
And of course I'm assuming the rom is deodexed
 

abhishekr700

Senior Member
Mar 20, 2013
1,213
763
New Delhi
www.geeksunboxed.com
Just because the apk recompile doesn't mean the mod has been done correctly - it just means there are no syntax errors

For example

You can have a smali file with a value that points to 0x965236 in public.xml

But if this value is wrong or relates to something else than it will cause a bootloop either on startup or when that reference is activated eg a button press


Can't help you any other way - my guess is incorrect modification - logcat it & find out
And of course I'm assuming the rom is deodexed
Sir u misunderstood me im getting these warning while recompile when i have not modded anything

Straight decompile then recompile
They come on rc3/4

Sent from my C2305 using Tapatalk
 

TheFixItMan

Senior Member
Jul 8, 2012
7,844
4,052
London
Sir u misunderstood me im getting these warning while recompile when i have not modded anything

Straight decompile then recompile
They come on rc3/4

Sent from my C2305 using Tapatalk

Ignore it - they are beta versions anyway designed for KitKat/lollipop framework which you are not using - keep telling you this

You need to use version 1.5.2
 

sukhraj.mahal

Member
Jul 12, 2014
5
0
Decompiling Arsc

Thanks for this!. Im trying to decompile a resources.arsc file from a system image so I have no framework etc. I know apktool does resources.arsc but I cannot figure out how to. I have searched google and XDA as much as I can. So if someone could direct me to link that doesnt talk about apks but arsc instead or help me out thanks
 

srisurya95

Inactive Recognized Contributor
May 20, 2013
2,933
7,202
Hyderabad
OnePlus 8
I get this error when I try to install framework
Code:
Exception in thread "main" brut.androlib.AndrolibException: Invalid value type:
0
        at brut.androlib.res.data.value.ResValueFactory.factory(ResValueFactory.
java:64)
        at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:242)

        at brut.androlib.res.decoder.ARSCDecoder.readComplexEntry(ARSCDecoder.ja
va:230)
        at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:200)

        at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:188
)
        at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:156)
        at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:11
3)
        at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:39)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:678)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:660)
        at brut.androlib.Androlib.installFramework(Androlib.java:641)
        at brut.apktool.Main.cmdInstallFramework(Main.java:240)
        at brut.apktool.Main.main(Main.java:87)
 
Last edited:

Skidiver

Senior Member
Dec 10, 2010
286
75
I get this error when U try to install framework
Code:
Exception in thread "main" brut.androlib.AndrolibException: Invalid value type:
0
        at brut.androlib.res.data.value.ResValueFactory.factory(ResValueFactory.
java:64)
        at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:242)

        at brut.androlib.res.decoder.ARSCDecoder.readComplexEntry(ARSCDecoder.ja
va:230)
        at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:200)

        at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:188
)
        at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:156)
        at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:11
3)
        at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:39)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:678)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:660)
        at brut.androlib.Androlib.installFramework(Androlib.java:641)
        at brut.apktool.Main.cmdInstallFramework(Main.java:240)
        at brut.apktool.Main.main(Main.java:87)
I get a could not decode message. Can somebody help with this?
Thanks in advance!
 

hawk1997

Member
Jan 13, 2016
16
0
ahmedabad
I've seen many users inquiring about how to decompile apps. Although there are many threads on this, still users don't search. So i decided to create this guide as our GT-S5360 forum didn't have one. I learnt this from v6ser's tut about 5-6 months ago, so i would like to thank him before starting this guide. Please PM me guys if I've missed something or written something wrong!

What is decompiling?
Android apps are BASICALLY made up of Java codes and XML files. After compiling the app, these files cannot be viewed. Decompiling is a process which decompiles the binary form of XMLs and .Java files into readable form. The XML files can be retained as it is, but the .java files are converted into smali files, a totally different language.

What is recompiling?
Recompiling is simply a way to convert the XML and smali files back into the binary form and building up of the APK with the changes made. All apps after recompiled have to be signed (except system apps).

Let's start!

Things needed :-
JRE (Java Runtime Environment)
Windows - Download apktool
Download apktool-install-windows
Place both apktool files in C:\Windows"HERE"

First off, you need to install the framework.
The three apks needed :-
framework-res.apk (location : /system/framework)
SystemUI.apk (location : /system/app)
twframework-res.apk (location : /system/framework)

Go to Command Prompt, and type :-
Code:
apktool if {framework's folder/location}
Example in the image here :-
image.png


Repeat the same step for SystemUI.apk and twframework-res.apk too, besides framework-res.apk
These will be saved here - C:\Users\your_user_name\apktool"HERE"

Next step, is the decompiling.
Code:
apktool d C:\filename.apk C:\folder_of_the_decompiled_files
Example in the image here :-
image.png


Now, you can view the XML and smali files. I would recommend Notepad++ to edit them.
After making your changes, you're gonna need to recompile so that the files are again in the apk form.

Next step, recompiling.
Code:
apktool b C:\folder_of_the_decompiled_files C:\newfilename.apk
(You can use other directories too, I've just used C:\ as an example)
Example in the image here :-
image.png


Now, final step is signing the apk file.
Remember don't sign the apk if it's a SYSTEM app, unless you have edited the AndroidManifest.xml.

Signing.
Download the zip file here :- http://www.mediafire.com/?gs6n10oh09c039n
Extract the files in a folder named "SignApk", in any convienient location. (I preferred C:\)

Example of the code in image here :-
sign.png


That's it! I hope this guide helps a lot of newbies and other users out there!:D
I got These Error.
error_log_13385382852952.png
 

Top Liked Posts

  • There are no posts matching your filters.
  • 159
    I've seen many users inquiring about how to decompile apps. Although there are many threads on this, still users don't search. So i decided to create this guide as our GT-S5360 forum didn't have one. I learnt this from v6ser's tut about 5-6 months ago, so i would like to thank him before starting this guide. Please PM me guys if I've missed something or written something wrong!

    What is decompiling?
    Android apps are BASICALLY made up of Java codes and XML files. After compiling the app, these files cannot be viewed. Decompiling is a process which decompiles the binary form of XMLs and .Java files into readable form. The XML files can be retained as it is, but the .java files are converted into smali files, a totally different language.

    What is recompiling?
    Recompiling is simply a way to convert the XML and smali files back into the binary form and building up of the APK with the changes made. All apps after recompiled have to be signed (except system apps).

    Let's start!

    Things needed :-
    JRE (Java Runtime Environment)
    Windows - Download apktool
    Download apktool-install-windows
    Place both apktool files in C:\Windows\"HERE"

    First off, you need to install the framework.
    The three apks needed :-
    framework-res.apk (location : /system/framework)
    SystemUI.apk (location : /system/app)
    twframework-res.apk (location : /system/framework)

    Go to Command Prompt, and type :-
    Code:
    apktool if {framework's folder/location}
    Example in the image here :-
    image.png


    Repeat the same step for SystemUI.apk and twframework-res.apk too, besides framework-res.apk
    These will be saved here - C:\Users\your_user_name\apktool\"HERE"

    Next step, is the decompiling.
    Code:
    apktool d C:\filename.apk C:\folder_of_the_decompiled_files
    Example in the image here :-
    image.png


    Now, you can view the XML and smali files. I would recommend Notepad++ to edit them.
    After making your changes, you're gonna need to recompile so that the files are again in the apk form.

    Next step, recompiling.
    Code:
    apktool b C:\folder_of_the_decompiled_files C:\newfilename.apk
    (You can use other directories too, I've just used C:\ as an example)
    Example in the image here :-
    image.png


    Now, final step is signing the apk file.
    Remember don't sign the apk if it's a SYSTEM app, unless you have edited the AndroidManifest.xml.

    Signing.
    Download the zip file here :- http://www.mediafire.com/?gs6n10oh09c039n
    Extract the files in a folder named "SignApk", in any convienient location. (I preferred C:\)

    Example of the code in image here :-
    sign.png


    That's it! I hope this guide helps a lot of newbies and other users out there!:D
    5
    Reserved. why use it when you have apk manager and VTS?
    5
    Thx a lot for the tutorial mate! It's really helpful!

    1 question! : If I want to edit the framework( I get it from another mod, so it's not my stock framework). Do I need to install the framework every time I want to mod a framework that I just get?


    Thx a lot man!



    I'm a newbieee:fingers-crossed::fingers-crossed::fingers-crossed:

    No need...i mod many roms' frameworks but the installed one in apktool is repencis framework....btw, it would be better if you do it...

    You can always press the thanks button if you wanna thank me!

    Sent from my GT-S5360 using xda premium
    2
    Reserved. why use it when you have apk manager and VTS?

    I and many other users prefer it a for being simple. Apk manager and others can cause a lot of trouble when you don't have adb, or anything else.
    2
    Very nice thread..... Really helpful for all new user........

    Sent from my GT-S6102 using Tapatalk 2