yashsingh1/xdaforums huggingface dataset:
[Android Software Development] aguha1044:
Guide to decompile android application

​

REQUIREMENT

Apktool [click here to download][Thanks to brut.all for this apktool]

Java JDK/JRE 32 bit [please google it guy's]

Little knowledge on cmd ;)

_________________________________________________________________________________________________________________________

Preparation before WORKING

Process :-

1)now install the java in your pc/lappy

then copy the apktool.zip & goto directory C:/

make a folder name apktool (u can name it by watever u like)

now goto that folder & paste the zip

extract that zip there...

2) now copy the .apk or jar file which u wnt to decompile

& paste it on apktool folder.....

also copy the framework-res.apk of that rom &

paste it on that folder..

Decompiling application

3) now open cmd

Your cmd will probly look like this..

C:\users\yourname>

so type in

cd.. (yes include the '..' and press enter after you type each command)

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

cd apktool (and you are in the apktool directory)

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

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

5)now to decompile the apk you want to edit.. type this:

apktool d music.apk mod

music.apk is the apk your decompiling

mod is the folder you're creating for the decompiled apk

do whatever you want to do with your apk... :D:D:D

NOW RECOMPILING

6)now to recompile your new apk type this:

apktool b mod music-new.apk

mod is the folder with your edited files

music-new.apk is your new apk file

Now we are NOT done... we cannot use the new apk's...

now make two separate folder a & b

copy-paste the original music.apk in 'a'

& music-new.apk in 'b'

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

now add to archive ...the origanl apk in zip format

& at the end of the file name .apk ( i mean give the file format name as .apk insted of .zip)

Now you are almost done.....:thumbup:

IF it is a system app then don't sign it....otherwise u have to sign that app....

[=>Guide On How To Sign The Moded App<=]

NOTE:- If you are getting this error =>" java is not a recognized internal or external command "

[=>Then Follow this Guide<=][Thanks to KartzXDA]:good:

That's all

don't forget to hit thanks or comment....:D:good:

All Mod-Rom by Abhijit Guha

(mee)

1} X-zooM[V2] (Netlock free : Transparent Rom):good:​

2}Tutorial On Decompiling Android Apps:o​

3.Guide To Make Transparent Power Widget​

.

4.Guide To Change Statusbar Clock & Notification colour​

.

5.Guide On How To Sign The Moded App​

.

6.Guide On How To SetUp Environmental Variables​
[Android Software Development] roxtreeme:
cool.........
[Android Software Development] rivelta:
thank for nice guide

sent from my ass ®
[Android Software Development] lokeshsaini94:
Insted of so much to cd folder just right click the folder while holding shift button and you will see adbance options... now open command prompt.. It will save time and is very easy ....
[Android Software Development] aguha1044:
I think you haven't followed something...... this guide is for begginers...so it should be simple one.... not eeky :eek:
[Android Software Development] lokeshsaini94:
This is simple method to cd a folder in cmd without all that long commands.... I always use it... Try it once and you will know what i am trying to say....
[Android Software Development] cowsquad:
Thank s for this awesome guide
[Android Software Development] delsus:
Awesome guide, very simple to decompile and recompile with it.
[Android Software Development] taomorpheus:
Cool guide! I will use it to do some tests with my apks :D
[Android Software Development] virgo2000:
solved problem lol ... good tutorial ...

xda facebook page should share more tutorials like this!!
[Android Software Development] AlwaysDroid:
Yeah mine says java is not a recognized internal or external command, operable program or batch file. I probably have to add the environment variable, but im not sure how to.

EDIT: got it.
[Android Software Development] aguha1044:
You getting this error coz you giving those command in some other directory.........

Note:- First u have to go th that directory or folder where ur apktool files are kept...... then u will not get such error......

Follow that guide from begging then u will get wat I wanna say. best of luck :good:
[Android Software Development] AlwaysDroid:
No, I just forgot to add the java bin to PATH variable. All good :)
[Android Software Development] cowsquad:
For the OP. Some ROMs like miui ROM use two frameworks ( framework-res.apk and framework-miui-res.apk) so you need to specify that on the guide. I am just trying to help :)

tapatalked² cowsquadGnex®
[Android Software Development] zain0300:
can you tell how to add JAVA bin? I am getting the same error on cmd. thank you
[Android Software Development] KartzXDA:
How to setup the environment variable

TECHNICAL INFORMATION

The PATH is the system variable that your operating system uses to locate needed executables from the command line or Terminal window.

The PATH system variable can be set using System Utility in control panel on Windows, or in your shell's startup file on Linux and Solaris.

SOLUTION

Here PATH represents the bin path of installed version of Java that contains classes. (e.g. C:/jdk1.6.0/bin)

Setting Path on Windows

Windows 7

1. Select Computer from the Start menu

2. Choose System Properties from the context menu

3. Click Advanced system settings > Advanced tab

4. Click on Environment Variables, under System Variables, find PATH, and click on it.

5. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH,

you may select to add a new variable and add PATH as the name and the location of the class as the value.

6. Reopen Command prompt window, and run your java code.

Windows XP

1. Start -> Control Panel -> System -> Advanced

2. Click on Environment Variables, under System Variables, find PATH, and click on it.

3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH,

you may select to add a new variable and add PATH as the name and the location of the class as the value.

4. Close the window.

5. Reopen Command prompt window, and run your java code.

Windows Vista

1. Right click My Computer icon

2. Choose Properties from the context menu

3. Click Advanced tab (Advanced system settings link in Vista)

4. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may

select to add a new variable and add PATH as the name and the location of the class as the value.

5. Reopen Command prompt window, and run your java code.

Setting Path on Solaris and Linux

To find out if the java executable is in your PATH, execute:

% java -version

This will print the version of the java executable, if it can find it. If you get error java: Command not found. Then path is not properly set.

To find out which java executable the first one found in your PATH, execute:

% which java

Below are the steps to set the PATH permanently,

Giving instructions for two most popular Shells on Linux and Solaris.

For bash Shell:

Edit the startup file (~/ .bashrc)

Modify PATH variable:

PATH="$PATH":/usr/local/jdk1.6.0/bin

export PATH

Save and close the file

Open new Terminal window

Verify the PATH is set properly

% java -version

For C Shell (csh):

Edit startup file (~/ .cshrc)

Set Path

set path="$PATH":/usr/local/jdk1.6.0/bin

Save and Close the file

Open new Terminal window

Verify the PATH is set properly

% java -version

Hit "Thanks" if anyone helped you. :good:

Xperia Arc LT15i

Rooted/Bootloader Unlocked

JellyBean - FXP137/CM10
[Android Software Development] zain0300:
i read all this but still could not figured it out since there were few options i did not find on my windows 7 laptop.

Edit: Ok i found all the options now but what does this mean "modify PATH by adding the location of the class to the value for PATH"?
[Android Software Development] KartzXDA:
Under system variables, find for the variable Path. Click on Edit. Then one window will come up with two text boxes. One is variable name and another one is variable value. Edit the variable value of text box. Add the the path of bin ( e.g., ; C:\jdk\bin [Don't forget to add semicolon before the path]) to the text box.

Please have a look at the attachments.

Hit "Thanks" if anyone helped you.

Xperia Arc LT15i

Rooted/Bootloader Unlocked

JellyBean - FXP137/CM10
[Android Software Development] zain0300:
thankx for your replies. I mistakenly deleted all the other paths that were already there, can I bring them back?

thanks button pushed.
[Android Software Development] KartzXDA:
copy this in the path variable value after that add ;C:\jdk....\bin

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShel l\v1.0\

Hit "Thanks" if anyone helped you. :good:

Xperia Arc LT15i

Rooted/Bootloader Unlocked

JellyBean - FXP137/CM10
[Android Software Development] system.img:
Thanks a lot. I figured out where I went wrong....

I have a doubt. Should I make a new classes.dex file out of the smali folder and add it in my modified apk if I do smali edits?

And will these steps work on Jelly Bean system apks also?
[Android Software Development] KartzXDA:
Hi,

I didn't find the thread "Guide to sign app". Could you please post the link for the guide. Thanks in advance.

Hit "Thanks" if anyone helped you. :good:

Xperia Arc LT15i

Rooted/Bootloader Unlocked

JellyBean - FXP137/CM10

---------- Post added at 02:24 PM ---------- Previous post was at 02:17 PM ----------

Yes. You can decompile the classes.dex into folder. Open the folder that was created and you will see all the smali files. These are what you need to edit to make your mods and again recomplile that folder to create the classes.dex. It will work for JellyBean apps too.

NOTE: the classes.dex is actually just an archive type container that contains the smali files (JAVA).

Hit "Thanks" if anyone helped you. :good:

Xperia Arc LT15i

Rooted/Bootloader Unlocked

JellyBean - FXP137/CM10
[Android Software Development] Theonewithideas:
Hey, the apks decomile fine, but when I try to recompile them, it stops at "Building resources" . Any solutions?
[Android Software Development] aguha1044:
Hmn I think something went wrong.....try again....coz it never get stcked at building resources......

It may show error & then the recompile recompile process left uncompleted.... but never get stucked.....

Try :good:
[Android Software Development] aguha1044:
Yes,surely u can do this..........

But ".dex" editing is little tricky...U need smali/Backsmali....

Still if you want to edit then extract the jar files you will get a 'classes.dex' inside..

Decompile it using Smali/Bcksmali...............Modify it......Recomplie it......Put it inside that extracted folder.......flash it.... :good:
[Android Software Development] Eklovya:
what the ***k.

No CREDITS for the DEVELOPER OF APKTOOL.?????

---------- Post added at 05:07 PM ---------- Previous post was at 05:07 PM ----------

what the ***k.

No CREDITS for the DEVELOPER OF APKTOOL.?????
[Android Software Development] AlwaysDroid:
Put this in op ! Good for others to use :)
[Android Software Development] aguha1044:
wat u mean by op????
[Android Software Development] AlwaysDroid:
Original post. Make a short section or a link to that post you made, so people don't keep asking that question. :) great guide BTW !
[Android Software Development] aguha1044:
Hmn okey.....
[Android Software Development] KartzXDA:
Please provide link

Hi Abhijit,

Can you please provide the link for "How to Sign App". I tried searching in the forum "Guide to sign App" but I didn't find.

Anyway Thanks for wonderful thread. :)

Hit "Thanks" if anyone helped you. :good:

Xperia Arc LT15i

Rooted/Bootloader Unlocked

Running Jelly Bean - FXP137/CM10
[Android Software Development] r4wky:
does the apk we are decompiling shoud be "deodexed"??

coz m trying with the odex apks....and its giving me "Can't find framework resources for package of id: 2. You must install proper fra

mework files, see project website for more info."
[Android Software Development] aguha1044:
No it doesnt matter whether your apk is deodexed or odexed.......

Actually You have skipped a step...you have to install the framework-res.apk properly before messing with further process....

So I will recommend you to follow the guide from beginning... :good:
[Android Software Development] aguha1044:
Link-Out

Hey sorry for being late....C the guide again...I have added the link to guide for sign apk there...

Happy signing apk's ;):D
[Android Software Development] timmetal6669:
What version of apktool does the link have?
[Android Software Development] :
That was very helpful.
[Android Software Development] sonimayurp:
PHONE.APK

Not working on phone.apk

Im using LG Optimus Black using Zeus 3.9 should i sign it???
[Android Software Development] aguha1044:
Nope... no need to sign phone.apk
[Android Software Development] sonimayurp:
Hi i just changed the incoming call background image... after recompile apk what should i do.. i followed all the steps but when i pushed it into system apps it forces close...how should i push it again into system app???
[Android Software Development] Invicta:
what is the procedure when we want to actually change framework-res.apk? i mean something inside the apk
[Android Software Development] cowsquad:
You have to decompile the apk first lol. That is the first step :)

tapatalked² from cowsquadGnex®
[Android Software Development] Theonewithideas:
What is apktool.yml ? When is it created?
[Android Software Development] aguha1044:
hey dude this guide is just for decompiling/recompiling android app......not on how to theme....

If you want to know how to work with framework-res.apk then in xda search for how to theme android.:good::laugh:;)
[Android Software Development] Spex:
i get error when recompiling framework-res.apk

i only do some changes in

values/bools
[Android Software Development] cowsquad:
What error man? If you need help, you must provided more info :) don't be shy :)

tapatalked² from cowsquadGnex®
[Android Software Development] kumar.aashish:
I have tried decompiling an app..worked perfect. The problem starts when I recompile. After recompilation when I extracted both the apk's (original and recompiled one) some of the xml's which I edited were missing. I copied resource file anyway and compressed it again. I signed the app. But when I run it on my phone it gives parsing error. Have I missed something??

Edit: I used winrar for extracting and compressing, and the folder missing is res/values/ in this folder i changed some xml's but after recompiling this folder was gone. It is also not there in the original apk
[Android Software Development] kantbstopped519:
I'm most likely forgetting to do something simple with a path name, but I'm trying to install the framework res with the line apktool if framework-res.apk but I get this:

'apktool' is not recognized as an internal or external command, operable program or batch file.

What simple thing am I forgetting here?

EDIT: Never mind lol was missing a file
[Android Software Development] nrgmalik:
Same is the case with me. After recompilation we dont get the xml files we changed in re/values/??? I have used 7zip, any help??

---------- Post added at 12:05 AM ---------- Previous post was at 12:02 AM ----------

Is Java path setup properly?? Pls check again.
[Android Software Development] fareed_xtreme:
I decompiled everything fine alright... Made a few changes and got errors. I even tried to recompile without any changes and still I get this error.

This is a SystemUI.apk of ICS Stock Xperia U ROM
[Android Software Development] sandy7:
Did u replace meta inf from original apk?
[Android Software Development] silver1882:
Im getting the same errors and all I did was decompile a Calculator.apk and then try recompiling it.
[Android Software Development] fareed_xtreme:
Am I supposed to? All I did was decompile SystemUI and change values of 1 xml file and tried recompiling it. If I am supposedly missing something pls let me know.

PS: Noob Alert.
[Android Software Development] sandy7:
Well the systemui u were decompiling is from GB or ICS

For me I always use akpmanger ics when decompiling my miui systemui....

Or give ur system ui and tell me what I should do..ill try it.
[Android Software Development] varun.chitre15:
Make sure you are using latest apktool and aapt

It looks to be aapt issue

Get it from here and from now post your issues in below thread as iBotPeaches is developer of Apktool.

http://xdaforums.com/showthread.php?t=1755243

Hope that helps

Just wonder, op opened the thread and disappeared for giving assistance to users :silly:
[Android Software Development] fareed_xtreme:
Awesome Bruv... It worked... I noticed I was using the aapt that was made sometime in the early 2011... No wonder :p Thanks... Now I can get started as a Themer :P

P.S.: I have been hunting for some answers for a long time now... Never came across that thread though until now.. Well thanks again.
[Android Software Development] BuildUpNow:
If anyone runs into this issue it's because you need to run the command prompt as admin. Search for cmd then right and run as administrator and the error msgs should be gone.
[Android Software Development] M4ST3R-V:
Thanks a lot

Thanks a lot for this awesome guide :) Really helpful :good:
[Android Software Development] s!mon:
looks very interesting but I have one noob question...

you mentioned in the beginning " also copy the framework-res.apk of that rom &... "

where can I get that apk file?

Also is it possible to do changes in an app f.ex change some texts or set new pictures and then recompile it?
[Android Software Development] greedisgood99999:
i want to try thia one..is there any tutorial when i can change the black bg of app drawer?.hope this tool cud help me..im using a aosp rom based on cm10.1..thanks.c:
[Android Software Development] Minimilised_MR:
Recompiling Error

Hey, aguha1044

I've got a problem .. I followed as per your instructions on your thread ..the apk got decompiled successfully and after i made some smali changes ...then i recompiled it back and it gave me the following error.

Please Tell me how to fix it?

PS: I tried to run cmd as admin but no solution!
[Android Software Development] lead3r1:
gr8 job man ur post is proving to be must for any Android fan themer alike tnx :)
[Android Software Development] dargor1406:
I dont know what you mean by "any xml files edited" if the edited xml that I edited cannot be "decompress"

so I cannot find these files
[Android Software Development] Cilenco:
I do not understand the last step. I edit the string.xml from the values-de folder and the app icon in drawable-hdpi. Now I compile the app and that works fine but which files do I have to put now in the old apk file? And can I drop the files in 7Zip and overwrite them or do I have to unzip it and so on?
[Android Software Development] SXUsr:
Give my guide a read, it's a bit more clearer. :)
[Android Software Development] mrpeev:
everything's fine but cant recompile it :(
[Android Software Development] SXUsr:
Remove .apk, so it should be apktool b Rosie1. I don't understand why you would add "mod" to the code, I know it says in the OP but I've never seen that before.
[Android Software Development] noooooo:
i get thi error tryng to install framework re :(
[Android Software Development] TheEndGame7:
I appreciate the HELP in advance! Can anyone give me a idea of what's going wrong here: http://pastebin.com/9MqQzSne

I did what was suggested here:

and was able to get the decompiling to work no problem! Thanks varun.chitre15

but now trying to recompile i get the errors in the pastebin link.

I tried:

and get the same results! Any other suggestions?

it's a SecPhone.apk

I'm running Win 7 Ultimate 64bit
[Android Software Development] J0hny:
Hi guys,

I am trying to change the order of the quick settings buttons on ICS 4.0.1 on Galaxy s7562. I am using apktool1.5.2 and apktool-install-windows-r05-ibot (which are the latest I think) and I run CMD as administrator. I have decompiled SystemUI.apk, changed the order in \SystemUI\res\values\arrays.xml, but when I try to recompile I get:

C:\Windows\apktool>apktool b system system.apk

W: Could not find sources

I: Checking whether resources has changed...

I: Building apk file...

when I check the new apk it's smaller, some xmls are missing(including the one I have changed), so I cannot replace the new .xml file that I have modified in the old apk.

Besides that should I copy resources.arsc, even if I haven't changed it?

Please advise how to proceed with this.

Thanks a lot in advance!

PS: I am a newbie in decompiling/recompiling :)

EDIT: I just checked and \SystemUI\res\values\arrays.xml is not visible in the original SystemUI.apk when I open it with 7-Zip. How can I extract in and replace it if it is not visible in the original and the newly created APK? Please help.

EDIT 2 : Succeeded :victory: Just copied META-INF and AndroidManifest.xml from the original SystemUI.apk to the newly created and now it works.
[Android Software Development] Adizzzle:
:good:

First of all this tool is amazing, but sadly doesn't work properly when

trying to re-compile the app after making changes to the "Values" folder

Can anyone possibly give me a hand in looking at the log?

I'm new to all this and have searched high and low, to get this to work,

I'm willing to bet the answer is staring me in the face, I just can't see it. :p

I'm using Windows 7 btw

C:\AndroidApktool>cd C:\AndroidApktool

C:\AndroidApktool>apktool b C:\AndroidApktool\SecMms

C:\AndroidApktool>I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
C:\AndroidApktool\SecMms\res\xml\widget_info.xml:2: error: No resource identifier found for attribute 'widgetCategory' in package 'android'
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 14, --target-sdk-version, 16, -F, C:\Users\Adizzzle\AppData\Local\Temp\APKTOOL7508301833281963178.tmp, -I, C:\Users\Adizzzle\apktool\framework\1.apk, -S, C:\AndroidApktool\SecMms\res, -M, C:\AndroidApktool\SecMms\AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
at brut.androlib.Androlib.buildResources(Androlib.java:283)
at brut.androlib.Androlib.build(Androlib.java:206)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 14, --target-sdk-version, 16, -F, C:\Users\Adizzzle\AppData\Local\Temp\APKTOOL7508301833281963178.tmp, -I, C:\Users\Adizzzle\apktool\framework\1.apk, -S, C:\AndroidApktool\SecMms\res, -M, C:\AndroidApktool\SecMms\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:357)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 14, --target-sdk-version, 16, -F, C:\Users\Adizzzle\AppData\Local\Temp\APKTOOL7508301833281963178.tmp, -I, C:\Users\Adizzzle\apktool\framework\1.apk, -S, C:\AndroidApktool\SecMms\res, -M, C:\AndroidApktool\SecMms\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:89)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:355)
... 6 more