[HOW-TO] Decompile ICS and above apk and jar files MANUALLY - Android Software/Hacking General [Developers Only]

With the number of ICS ROMs that are popping out, I imagine the majority of people are spending their time on ICS rather than Gingerbread or Froyo. With that in mind, here's a little guide on how to decompile ICS .apk and .jar files (such as the troublesome SystemUI.apk) with ease so that you can mod them to your heart's content. I assume this method will work for other versions of Android as well. Just so we understand each other, this just helps you decompile the classes.dex. If you want to decompile an entire app or jar file there are other guides for that.
NOTE: We will NOT be using ApkTool, Apk Manager, or StudioAndroid to do this. Mainly because I have had trouble in the past using those applications to decompile certain files. So, here is an ALL MANUAL way.
What you need:
Deodexed .apk/.jar file
smali.jar
baksmali.jar
7zip or Betterzip (whether you are on Mac, Linux, or Windows)
terminal/cmd (depending on what you're running)
You can get the smali.jar and baksmali.jar files from here: http://code.google.com/p/smali/downloads/list
Download these files:
Code:
baksmali-1.3.3.jar
smali-1.3.3.jar
and rename them to:
Code:
baksmali.jar
smali.jar
Now that you have both files, place them somewhere you'll remember (like a folder on your Desktop). For the purposes of this guide, my files will be in .../Desktop/ICS
Ready? Okay, here we go.​
Open up your desired ICS .apk or .jar file with 7zip or Betterzip and extract the classes.dex and move it into the directory where you have baksmali.jar and smali.jar (For example, I move the classes.dex file to .../Desktop/ICS)
Open up terminal or cmd
cd to your directory
Example:
Code:
cd .../Desktop/ICS
Type the following:
Code:
java -jar baksmali.jar -o classout/ classes.dex
This will decompile the classes.dex file and create a folder inside .../Desktop/ICS called classout where all of your smali files will be located.
Go into the classout folder and make your smali edits
Compile your classout folder into new-classes.dex by typing this into terminal:
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Rename new-classes.dex to classes.dex
Take your newly compiled classes.dex and put it into your ICS .apk or .jar using 7zip or Betterzip
Profit
Have fun :highfive:

Nice to have a write up on this in the Inc forums instead of having to hunt it down all the time. I've found it best to use smali and baksmali too, the apk aps were just too flaky for me.

kzoodroid said:
Nice to have a write up on this in the Inc forums instead of having to hunt it down all the time. I've found it best to use smali and baksmali too, the apk aps were just too flaky for me.
Click to expand...
Click to collapse
Yeah I've had similar experiences as well. This method was the only one that worked flawlessly for me. Hopefully it works for you and everyone else who needs to modify ICS files.

I've used it in GB to do some of the modifications to the status bar, like hide the clock. Took the better part of a day googling to actually find a write up on how to use baksmali and smali as I couldn't get apkTool or apkManager to decompile or compile classes.dex properly. Now I know where to find the instructions when I need them again.

thank you for this nice write up. It did really help me

Man you are just awesome for posting this, I have been googling how to decompile and recompile .apk's and .jar's for a couple of days and nothing has worked. This worked great the first time around and was very simple to follow. I just hope that once I am done making my editsI do not have any troubles re compiling the .jar I am working with lol.
You know it is so ironic that I found your guide here on XDA. It seems like everytime i want to learn how to do something like this I can google all day without much success on finding something that works. But when I do find something that works around 90% to 95% of the time it is here on XDA. You have got to love XDA...

T-Macgnolia said:
Man you are just awesome for posting this, I have been googling how to decompile and recompile .apk's and .jar's for a couple of days and nothing has worked. This worked great the first time around and was very simple to follow. I just hope that once I am done making my editsI do not have any troubles re compiling the .jar I am working with lol.
You know it is so ironic that I found your guide here on XDA. It seems like everytime i want to learn how to do something like this I can google all day without much success on finding something that works. But when I do find something that works around 90% to 95% of the time it is here on XDA. You have got to love XDA...
Click to expand...
Click to collapse
Yeah XDA does seem to be the go-to place for everything lol. Glad to know it worked for you

Note that you still need apktool in order to decompile/recompile XMLs and PNGs in apk files.

kong said:
Note that you still need apktool in order to decompile/recompile XMLs and PNGs in apk files.
Click to expand...
Click to collapse
Are there no other standalone command line tools for those tasks?

SifJar said:
Are there no other standalone command line tools for those tasks?
Click to expand...
Click to collapse
I would like to know that as well...

Wow, thank you very much. I'm going to have fun with this.
Sent from my Desire HD using xda premium

Thanks for the tutorial, I have successfully extracted the classes.dex but i cant seem to find where to add this code:http://forum.xda-developers.com/showpost.php?p=16485374&postcount=15 in the NotificationManagerService.smali file. I have even opened up a file that supposedly has the patch in it but could not locate it. A point in the right direction would be appreciated.

Great tutorial awesome work
Sent from my Galaxy Nexus using Tapatalk 2

i wan to edit samsungcamera.apk...
i can not find classes.dex inside this apk....
only got META_INF,res,AndroidManifes.xml and resources.arsc....

Have you decompiled it first?
Sent from my Galaxy Nexus using Tapatalk 2

Hey I made some changes in the AssetManager.smali and now I can't recompile. Getting this error Error: Unable to access jarfile smali.jar
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Cannot find file or directory "classout/"
at org.jf.smali.main.main(main.java:184)

didi1985 said:
i wan to edit samsungcamera.apk...
i can not find classes.dex inside this apk....
only got META_INF,res,AndroidManifes.xml and resources.arsc....
Click to expand...
Click to collapse
Is your rom deodexed?
Sent from my PantechP9070 using xda premium

Great guide easy to understand.
Thank you.

Reply To Thread
This is one of the best tutorial... Keep it up bro!

Help me, i can't edit .smali, because i don't understand smali,.
have any help?
like convet to java or any langgue ?

Related

Modifying .xml's that are encoded into resources.arsc

Ok this is a quick little guide. Decided not to put this in the notification text thread as that needs to be cleaned up anyway.
This is for modifying .xml's in say /values or wherever you want. This particular example is going to use /values/styles.xml
First up, decode your framework using apktool
** Make a backup! **
Code:
: adb pull /system/framework/framework-res.apk /sdcard/mytheme/backup.apk
: adb pull /system/framework/framework-res.apk C:\themes\mytheme.apk
: apktool d -f C:\themes\mytheme.apk C:\themes\mytheme\decoded\
Then open up the /res/values/styles.xml.
Find "<style name="Widget.Button" parent="@style/Widget">
Change the textcolor to #FFFF0000
This will make all buttons have a RED text color.
Click to expand...
Click to collapse
Now re-encode the file
Code:
:apktool b C:\themes\mytheme\decoded C:\themes\mytheme\encoded\mytheme-new.apk
Now, the simplest thing to do is to do the following:
- Open the original C:\themes\mytheme.apk with 7-zip
- Drag and drop the META-INF and AndroidManifest.xml File into a folder, like C:\themes\mytheme\signed
* Now you have a copy you can always use, and skip the above steps after doing it once *
- Open the new encoded mytheme-new.apk with 7-zip
- Drag and drop the META-INF and AndroidManifest.xml from the \signed directory
Click to expand...
Click to collapse
Code:
: adb push C:\themes\mytheme\encoded\mytheme-new.apk /sdcard/mytheme/framework-res.apk
: adb remount (if available for you!)
: adb shell
**Only if remount doesn't work.**
: mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
: cp /sdcard/mytheme/framework-res.apk /system/framework/framework-res.apk
**Wait for the theme to apply, no need to reboot**
**If you Bootloop and stay in shell (which you should if you don't reboot)**
Click to expand...
Click to collapse
Code:
: cp /sdcard/mytheme/backup.apk /system/framework/framework-res.apk
**After this the bootloops should stop as your last stable framework is loaded**
Click to expand...
Click to collapse
That's it!
Questions? Comments? Leave em!
So, for instance, in the Vanilla Froyo theme for 2.1, where all of the text elements that should be a dark grey or black are white, this would allow me to change them?
Yep. Just a matter of figuring out which style controls what...that's next on my list to document lol. It's a LOT easier than trying to Hex Edit everything.
I'm really surprised this thread isn't exploding with questions, but I have to say great work, man!
I'm gonna wait it out until I know my way around the SDK a little more, but I really wanna dig through this and finish the Vanilla theme I'm using.
Thanks! I should make one big guide get it stickied and be fine with it lol. You can check out my vanilla theme fire an idea of what I've done.
Sent from my DROIDX using XDA App
Great tutorial man. I especially appreciate the part about not having to reboot. I wonder why everyone always says to do that for installing themes.
If you use apkmanager (which is a frontend for apktool) -- it automates some of the steps mentioned here. Its in the G1 development section as well as apktool.
Not work...
Very sad
After complete all steps, device not boot after LG lable longer.
Any ideas?
log cmd in process:
Code:
D:\Android\SDKTools\tools>apktool d -f C:\themes\mytheme.apk C:\themes\mytheme\decoded\
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
D:\Android\SDKTools\tools>apktool b C:\themes\mytheme\decoded C:\themes\mytheme\encoded\mytheme-new.apk
[B][COLOR="Red"]W: Could not find sources[/COLOR][/B]
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
phimuskapsi said:
Thanks! I should make one big guide get it stickied and be fine with it lol. You can check out my vanilla theme fire an idea of what I've done.
Sent from my DROIDX using XDA App
Click to expand...
Click to collapse
Phim, you're the best! I have been searching for a simple guide like this, as I found one a while ago when theming, but lost the link. Thanks for all your contributions on here, they are greatly appreciated! If I have some questions on editing some xml files, can I shoot you a PM or two?
Sent from my DROIDX using XDA App
I am trying to edit the color of the text in the drop down notification bar for the text such as USB Connection.
Can someone please tell me which xml file and which portion needs to be edited?
The font color would most likely be in the styles.xml file (in the values folder). I don't know which line exactly but you can take too different color versions and compare the decompiled xml files with word or online and look for differences.
yawdapaah said:
The font color would most likely be in the styles.xml file (in the values folder). I don't know which line exactly but you can take too different color versions and compare the decompiled xml files with word or online and look for differences.
Click to expand...
Click to collapse
Yae, thanks for the info. I found it shortly after posting through trial and error. I think it was in one of the status_bar_latest*.xml
For some reason when I made the esit and recompiled my famework-res.apk I lost adb capabilities and usb-mode and had to revert to a nandroid.
Any ideas on what may have caused this? Only edited an xml file...
Sent from my DROIDX using XDA App
.apk on desktop (adp pull C: [??])
phimuskapsi said:
Ok this is a quick little guide. Decided not to put this in the notification text thread as that needs to be cleaned up anyway.
This is for modifying .xml's in say /values or wherever you want. This particular example is going to use /values/styles.xml
First up, decode your framework using apktool
** Make a backup! **
Code:
: adb pull /system/framework/framework-res.apk /sdcard/mytheme/backup.apk
: adb pull /system/framework/framework-res.apk C:\themes\mytheme.apk
: apktool d -f C:\themes\mytheme.apk C:\themes\mytheme\decoded\
Click to expand...
Click to collapse
Hi there, newbie here (but I've managed to decode all the java and xml, which is fully readable). Only thing I have left is this pesky "resources.arsc" file. I tried using both the xml way and java way, but neither worked, that's when I found your posting. Thanks so much for sharing btw!!
I haven't tried this yet because I'm confused about why you did not put a "C:" in the beginning of the file address to route the command to the folder on your sdcard which contains your .apk.
My .apk will be on my desktop, so, how should my command line look???
Thanks again, hope to here from you.
Ok, I managed to decode everything except resources.arsc. I imported package successfully into eclipse but I have errors. I looked through all XML, which is in English and good, except for the resources.arsc, which is not decoding by methods I'm familiar with. Your method will probably work but I need command prompt spelled out for me (sorry about that).
So, resources.arsc is located: desktop/space/resources.arsc. I'll play around with it an see what happens...

Deprecated.

Deprecated.
Deprecated.
Deprecated.
I must be missing something..but how do i get to the com/android/server/status?
backdown said:
I must be missing something..but how do i get to the com/android/server/status?
Click to expand...
Click to collapse
This reference assumes that you already know how to recompile a framework file using smali/baksmali.
You're my hero for this, steel.
Just saying.
This is something that has driven me straight up the wall. Having so many useless icons means that when I finally do get some notifications, they get pushed right off the edge. I really can only seem to fit ~4 notifications most of the time before I get the arrow.
Well I've got the necessary lines changed to take out the location icons... Now to repackage it. Thanks for this!
Uh... I've never signed a .jar before. Anyone???
EDIT: I attached the services.jar I edited. It has to be signed for the phone to even boot up. Hopefully someone can sign this.
This is hot... I like it a lot. I have been looking for something like this for quiet awhile. Now to read up on smali/baksmali. I know how to edit a .jar file but there are "files" within that file.... Great... But I have to learn at least one thing a day right. If anyone has insight for me feel free to enlighten us but google search will suffice for now.
webby_s said:
This is hot... I like it a lot. I have been looking for something like this for quiet awhile. Now to read up on smali/baksmali. I know how to edit a .jar file but there are "files" within that file.... Great... But I have to learn at least one thing a day right. If anyone has insight for me feel free to enlighten us but google search will suffice for now.
Click to expand...
Click to collapse
Start here: http://code.google.com/p/smali/.
Thank you very much for posting this. This has been something bothering me since I got the device.
I have no idea how to use these tools, but I will figure them out.
EDIT: Figured it out. The steps worked! My taskbar is so clean and beautiful now!
Here are some VERY BASIC directions. Use at your own risk. They worked for me.
Make a backup of your services.jar on your device (or alternatively make a nandroid backup): adb shell cp /system/framework/services.jar /system/framework/services.jar.bak
Get services.jar from your device: adb pull /system/framework/services.jar .
Extract classes.dex from services.jar
Decompile the .dex file: java -jar baksmali.jar classes.dex -o outputdir
Make desired edits to the files now in outputdir/
Recompile the .dex file: java -Xmx512M -jar smali.jar outputdir/ -o classes.dex
Add the new (modified) classes.dex file to the existing services.jar file (which is actually a zip file)
Cross your fingers and push services.jar back to your device: adb push services.jar /system/framework/services.jar
Reboot device: adb reboot
How about someone post two edited and signed files to share with everyone else...?
EVOme said:
How about someone post two edited and signed files to share with everyone else...?
Click to expand...
Click to collapse
I believe (please correct me if I'm wrong) the services.jar could be different in certain ROMs or themes. It's better to make the edits yourself on the file that came off your device to preserve the integrity of the rest of your system.
EDIT: What we need is an app that makes the edits on the device for us...
Thanks, Xak
EVOme said:
Thanks, Xak
Click to expand...
Click to collapse
Sure thing. By the way, I love (and concur with) your avatar
So, as usual, I made this a lot more complicated than it needs to be. Somehow I was un-signing services.jar. I don't know. I got it to work now though. WORD!
many thanks to xak and the OP. with your help i was easily able to get rid of that pesky gps on/off icon! i appreciate the tips
Nice, this made me learn smali/baksmali and edit services.jar according to what I want.
Thanks!
webby_s said:
This is hot... I like it a lot. I have been looking for something like this for quiet awhile. Now to read up on smali/baksmali. I know how to edit a .jar file but there are "files" within that file.... Great... But I have to learn at least one thing a day right. If anyone has insight for me feel free to enlighten us but google search will suffice for now.
Click to expand...
Click to collapse
Very useful information about services.jar, smali/baksmali, classes.dex can be found HERE
As someone else mentioned, they learned how to use smali/baksmali and do customizations themselves. My OP along with the link posted here gives you all the info you need to perform these mods yourself, and at the same time you will learn a great deal on customizing your evo; The benefits of which are endless!
One final note, you need to use the services.jar from the ROM you are running, THEY ARE NOT interchangeable due to the fact that almost all ROM devs add some customizations into their roms.
SteelH - thanks for posting this! I love learning new things, so this was interesting... wasn't exactly sure where to start though, so these steps from xak were a great help.
xak944 said:
Thank you very much for posting this. This has been something bothering me since I got the device.
I have no idea how to use these tools, but I will figure them out.
EDIT: Figured it out. The steps worked! My taskbar is so clean and beautiful now!
Here are some VERY BASIC directions. Use at your own risk. They worked for me.
Make a backup of your services.jar on your device (or alternatively make a nandroid backup): adb shell cp /system/framework/services.jar /system/framework/services.jar.bak
Get services.jar from your device: adb pull /system/framework/services.jar .
Extract classes.dex from services.jar
Decompile the .dex file: java -jar baksmali.jar classes.dex -o outputdir
Make desired edits to the files now in outputdir/
Recompile the .dex file: java -Xmx512M -jar smali.jar outputdir/ -o classes.dex
Add the new (modified) classes.dex file to the existing services.jar file (which is actually a zip file)
Cross your fingers and push services.jar back to your device: adb push services.jar /system/framework/services.jar
Reboot device: adb reboot
Click to expand...
Click to collapse
In addition to these steps, I wanted to mention a few things... these might be obvious to most, but hopefully they help someone.
- to extract and re-add classes.dex from/to services.jar, use winzip
- to modify the .smali files that Steel mentions, use notepad
- you will need to mount /system as read/write before you can push services.jar back to the phone
- it took a long time for my phone to reboot... i got pretty nervous
thanks again, I love not having the alarm and gps icons taking up space

[SOLVED] Looking for help to remove clock from status bar.

Was searching the forums looking for a way to remove the clock from my status bar and have come to the conclusion it may be a little over my head at this point. Can make me a flashable zip to remove the clock? Or maybe some step by step instructions on how I would accomplish this? Thanks in advance.
Update 3/26---------------------------------------------------------------------------
JKILO is working on a flashable .zip for MikShift, so until then here's how you do it manually....
Instructions for removing status bar clock on an odex rom:
Props to JKILO and riggsandroid for helping a total noob and doing most of the work. Also thanks to Steelh for showing us the lines to replace. His method for deodex roms is here. If I forgot to add anyone that helped out, let me know. I always throw props where its deserved.
You are modding at your own risk. Nobody who helped bring this to you is responsible for bricked phones or temper-tantrums.
Requirements:
-Rooted Evo Shift
-Odex Rom
-Windows (I used Windows 7. If you are using another os, I'm sure you can figure it out. If not, ask)
-sdk properly set up
-smali\baksmali
-dexopt-wrapper
-knowledge of the above things (at least have the ability to google for info)
-a nandroid backup of your phone (for obvious reasons)
-patience
-/system mounted as r/w (I did this in terminal emulator from my phone: type:
"su" then hit enter. type: "mount -o rw,remount -t ext3 /dev/block/mmcblk0p26 /system" then hit enter)
First thing you need to do is pull services.jar from /system/framework;
-"adb pull /system/framework/services.jar"
Next you need to open up services.jar with 7zip or winrar or something similar
Pull classes.dex out into a working folder with smali\baksmali
(I just did everything in my platform-tools folder in sdk so I didnt have to switch back and forth. You can do it however you want.)
Open command prompt as administrator
Cd to your work folder
Type this line:
java -jar baksmali.jar classes.dex
This will will create a folder named out in your work folder
Navigate to \com\android\server\status and look for StatusBarPolicy.smali
Open StatusBarPolicy.smali with Notepad or something similar
Search for:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
Add the following line two spaces under that to look like this:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setinvisibilty(Landroid/os/IBinder;Z)V
It should look like this now:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setinvisibilty(Landroid/os/IBinder;Z)V
Now click file then save as. Be sure to change the file type or youll save it as a text file that is useless to you.
Now head back to your command prompt.
still being cd'd to your work folder, type this:
java -jar smali.jar out
This will create a new .dex file named out.dex. Rename it to classes.dex and replace the classes.dex from services.jar with the new one you just made.
Now place the modified services.jar and dexopt-wrapper on your sdcard and plug your phone into your computer. (charge only)
Back to command prompt in your platform-tools directory
Type these commands in the order they appear, hitting enter after each one:
-adb shell
-cd /system/bin
-busybox cp /sdcard/dexopt-wrapper /system/bin
-busybox chmod 755 dexopt-wrapper
-cd /sdcard
-dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/com.htc.framework.jar:/system/framework/com.htc.android.pimlib.jar:/system/framework/com.htc.android.easopen.jar:/system/framework/com.scalado.util.ScaladoUtil.jar:/system/framework/com.orange.authentication.simcard.jar
- busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
-cd /system/framework
-busybox cp /sdcard/new.odex services.odex
-busybox chmod 644 services.odex
-sync
-reboot
Your phone will reboot and, viola! NO Clock!!!!
bobtsunam said:
Was searching the forums looking for a way to remove the clock from my status bar and have come to the conclusion it may be a little over my head at this point. Can make me a flashable zip to remove the clock? Or maybe some step by step instructions on how I would accomplish this? Thanks in advance.
<Blaze One>
Click to expand...
Click to collapse
on page 2 of this forum.
http://forum.xda-developers.com/showthread.php?t=966190
riggsandroid said:
on page 2 of this forum.
http://forum.xda-developers.com/showthread.php?t=966190
Click to expand...
Click to collapse
Saw that one but I havent done anything to that extent before. Was really hoping someone had a zip out there I could flash. Oh well. Maybe in the future. Until then ill try my hand at compiling....
<Blaze One>
bobtsunam said:
Saw that one but I havent done anything to that extent before. Was really hoping someone had a zip out there I could flash. Oh well. Maybe in the future. Until then ill try my hand at compiling....
<Blaze One>
Click to expand...
Click to collapse
what rom are you on?
riggsandroid said:
what rom are you on?
Click to expand...
Click to collapse
Currently on infinite's 2.0.
<Blaze One>
So I'm still trying to figure this out. From what I read I need to edit system/framework/services/classes? How would I go about editing this?
<Blaze One>
bobtsunam said:
So I'm still trying to figure this out. From what I read I need to edit system/framework/services/classes? How would I go about editing this?
<Blaze One>
Click to expand...
Click to collapse
Download apktool - http://code.google.com/p/android-apktool/
Follow instructions to setup your machine (installing framework, etc)
Decompile the services.jar in the /system/framework folder
Edit the lines indicated in teh smali files and recompile.
Push updated services.jar to your phone, reboot (takes a while, has to rebuild dalvik cache) and you should be good to go.
Thanks. I'll attempt this when I get home. If/when I get this completed, is it possible to make a general .zip file for others to flash if they are interested in doing the same thing? I've seen the question posed on many forums but haven't found a file that can be flashed. Would be nice to have something everyone can benefit from...
Edit: I'm guessing its gonna be Rom specific?
bobtsunam said:
Thanks. I'll attempt this when I get home. If/when I get this completed, is it possible to make a general .zip file for others to flash if they are interested in doing the same thing? I've seen the question posed on many forums but haven't found a file that can be flashed. Would be nice to have something everyone can benefit from...
Edit: I'm guessing its gonna be Rom specific?
Click to expand...
Click to collapse
Definitely rom specific. Unique for themes as well, I believe.
Sent from my MikShift.
smoothtaste said:
Definitely rom specific. Unique for themes as well, I believe.
Sent from my MikShift.
Click to expand...
Click to collapse
Figured as much. Hopefully I will be able to pull this off. I have not done any programming related stuff on Android yet. Most I've done is change an icon or two but that was pretty simple using ninjamorph. I literally know nothing about the file structure or coding. Might he time to start learning java at least if I'm gonna get into modding to this extent. We shall see how all this goes later tonight.
<Blaze One>
I have been trying to rebuild services.jar after editing StatusBarPolicy.smali and for some reason it doesn't work. I get something to this extent:
Exception in thread "main" java.lang.NullPointerException
(and then a bunch of other lines...)
Any idea what's goin on?
By the way, I'm replacing this:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
With this:
.line 593
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
Does this look right?
Thanks for any help...
Ok....I noob'd it. When a saved the changes to the StatusBarPolicy file I saved it as a text file somehow. Was able to build services.jar and push it back but the changes didn't take or something. Clock is still there. Am I editing the right line with right changes?
bobtsunam said:
Ok....I noob'd it. When a saved the changes to the StatusBarPolicy file I saved it as a text file somehow. Was able to build services.jar and push it back but the changes didn't take or something. Clock is still there. Am I editing the right line with right changes?
Click to expand...
Click to collapse
Just want to make sure - you restarted? It will take a little while because it has to rebuild the Dalvik Cache cause you modified the .jar file.
Yeah I actually mounted /system from recovery and pushed back in from there. I even tried it a second time, formatting dalvik cache. Do I need to restart an additional time?
<Blaze One>
bobtsunam said:
Yeah I actually mounted /system from recovery and pushed back in from there. I even tried it a second time, formatting dalvik cache. Do I need to restart an additional time?
<Blaze One>
Click to expand...
Click to collapse
No that should work the way you're doing it. Not sure...
riggsandroid said:
No that should work the way you're doing it. Not sure...
Click to expand...
Click to collapse
Just remembered something I saw as services.jar was rebuilding. Right before it finished it said sources not found. Don't know if this gives a clue. Also I'm running dreads blue honeycomb theme. Would that have something to do with it?
<Blaze One>
Figured I would post the steps I took in case I'm messing it up somehow. I'm using Windows 7.
First thing I did was adb pull services.jar from /system/framework using: adb pull /system/framework/services.jar
Moved services.jar to a folder I created on the root of my c: drive called test.
Opened cmd as an administrator.
Decoded services.jar using : apktool d services.jar which created services.jar.out in my test folder.
Navigated to StatusBarPolicy.smali @ c:\test\services.jar.out\smali\com\Android\server\status
Edited the lines as stated previously.
Opened cmd back up and rebuilt with: apktool b -f -d services.jar.out which put the new services.jar in a new folder called build located in services.jar.out
Noticed at this point that the meta file wasn't in services.jar so I copied from the original to the new.
Then pushed back to phone while in recovery using: adb push services.jar /system/framework and booted.
See anything I'm doing wrong?
<Blaze One>
You don't need apktool to do that. Use smali.jar and baksmali.jar to decompile and recompile.
http://code.google.com/p/smali/
Download the two jar files under featured downloads. For ease of typing, rename them baksmali.jar and smali.jar, respectively, and put them in c:\. Open as archive with 7zip to pull the classes.dex file out. Move classes.dex to c:\. Open admin cmd prompt and type:
java -jar -Xmx512M baksmali.jar c:\classes.dex
This will dump classes.dex into a folder c:\out. Make your smali edit then to recompile the dex file type:
java -jar -Xmx512M smali.jar c:\out
This will produce c:\out.dex. Move the file to your Desktop, rename it classes.dex and put it back in your services.jar. Push the file in recovery, no need to clear dalvik cache and it should work. If it's still not working, link me your original services.jar and I'll try to get it working for you.
EDIT: btw, kudos to you for taking the initiative to learn this. I have much respect for that.
EDIT 2: Are you on 2.0 odexed or deodexed?
Sent from my PG06100 using Tapatalk
tambourineman86 said:
You don't need apktool to do that. Use smali.jar and baksmali.jar to decompile and recompile.
http://code.google.com/p/smali/
Download the two jar files under featured downloads. For ease of typing, rename them baksmali.jar and smali.jar, respectively, and put them in c:\. Open as archive with 7zip to pull the classes.dex file out. Move classes.dex to c:\. Open admin cmd prompt and type:
java -jar -Xmx512M baksmali.jar c:\classes.dex
This will dump classes.dex into a folder c:\out. Make your smali edit then to recompile the dex file type:
java -jar -Xmx512M smali.jar c:\out
This will produce c:\out.dex. Move the file to your Desktop, rename it classes.dex and put it back in your services.jar. Push the file in recovery, no need to clear dalvik cache and it should work. If it's still not working, link me your original services.jar and I'll try to get it working for you.
EDIT: btw, kudos to you for taking the initiative to learn this. I have much respect for that.
EDIT 2: Are you on 2.0 odexed or deodexed?
Sent from my PG06100 using Tapatalk
Click to expand...
Click to collapse
Its mikshift lol we've been tryin to figure it out together..so odexed
Sent from my PG06100 using XDA App
You know apktool uses small baksmali right?
i find it easier to use the same program for stuff - its nice that apktool does both .jar and .apk files.
tambourineman86 said:
You don't need apktool to do that. Use smali.jar and baksmali.jar to decompile and recompile.
http://code.google.com/p/smali/
Download the two jar files under featured downloads. For ease of typing, rename them baksmali.jar and smali.jar, respectively, and put them in c:\. Open as archive with 7zip to pull the classes.dex file out. Move classes.dex to c:\. Open admin cmd prompt and type:
java -jar -Xmx512M baksmali.jar c:\classes.dex
This will dump classes.dex into a folder c:\out. Make your smali edit then to recompile the dex file type:
java -jar -Xmx512M smali.jar c:\out
This will produce c:\out.dex. Move the file to your Desktop, rename it classes.dex and put it back in your services.jar. Push the file in recovery, no need to clear dalvik cache and it should work. If it's still not working, link me your original services.jar and I'll try to get it working for you.
EDIT: btw, kudos to you for taking the initiative to learn this. I have much respect for that.
EDIT 2: Are you on 2.0 odexed or deodexed?
Sent from my PG06100 using Tapatalk
Click to expand...
Click to collapse
Sent from my PG06100 using XDA App

(GUIDE) How to use Apktool Apk manager Baksmali and Adb

Hello Guys....
Just been watchin around our forum and The Galaxy Fit Development Group in FB and came to know that many are not able to decompile, compile, using apktool and apk manager !!! And few are not able to use the baksmali tool and even Android debugging bridge (ADB) So Decided to make a Guide on How to use all these
The tools required are attached along with this file...
So here we go....
[How To Use APK Tool]
If you're using apktool for the first time thn
Place framework-res.apk and twframework-res.apk from STOCK Firmwares (Do not take it from Custom ROM )
Thn open command prompt in the current window and type the following code
Code:
apktool if framework-res.apk
apktool if twframework-res.apk
The Dependencies would be installed in apktool folder in C:\Users\USER NAME\apktool\framework and also check if u hav 1.apk and 2.apk present inside the folder
Decompile And Compile Apk's Using apktool
Place the apk file that u wish to decompile in the downloaded apktool folder
Open command prompt in the current window and type the following code
Code:
[To Decompile] apktool d "apk name.apk"
[To Recompile] apktool b "apk name"
Example:
Code:
[To Decompile Mms.apk] apktool d Mms.apk
[To Recompile Mms.apk] apktool b Mms
The Compiled apk would be in "dist folder" inside the "decompiled folder"
[How To Use APK Manager]
Always use apktool to install dependencies even if u r gonna use apk manager
Place the apk tat u wish to decompile in "Place here for modding folder"
Open Script.bat in the folder and Press 9 to decompile and 11 to recompile
The decompiled folder would be in "Projects" folder and recompiled apk would be in "place here for modding folder"
[How To Use Baksmali]
Smali/Baksmali is an assembler/disassembler for the dex format used by Dalvik
The names "smali" and "baksmali" are the Icelandic equivalents of "assembler" and "disassembler" respectively
Smali Editting can be done through apk tool as well as apk manager but all those needs experience and practice
Place either the .apk or .jar file who's dex u want to decompile in that baksmali folder
Right click and Edit 1.bat using notepad++
Code:
java -jar baksmali.jar -x "filename"."file extension" -o classout
Example:
Code:
[To Decompile Mms.apk] java -jar baksmali.jar -x [B]Mms.apk[/B] -o classout
[To Decompile android.policy.jar] java -jar baksmali.jar -x [B]android.policy.jar[/B] -o classout
U would get a folder called classout
Make necessary changes and to compile back just press 2.bat
U would get classes.dex in the current folder
Replace this classes.dex with the classes.dex in the unmodded file
[How To Use ADB]
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device
With this adb u would be able to push pull files from your mobile, Logcat and much more
I would explain only the basic that is used most often that is pullin and pushin of files
Place the file tat u r about to push into the ADB folder
Code:
[To Push system apps] adb push "[B]apk name".apk [/B]/system/[B]app[/B]/[B]"apk name".apk[/B]
[To Push system framework files] adb push [B]"name".jar[/B]/system/[B]framework[/B]/[B]"name".jar[/B]
[To Push files to your SD Card] adb push [B]"filename.extension"[/B] /sdcard/
Example:
Code:
[To Push Mms.apk] adb push Mms.apk /system/app/Mms.apk
[To Push android.policy.jar] adb push android.policy.jar /system/framework/android.policy.jar
[To Push files to your SD Card] adb push Readme.txt /sdcard/
Credits:
Google
And to all those who taught me [How To Use These]
Tools
Reserved
Rooting
Sorry, I know this is not the right thread to post this..
But i need help
I am a newbie and never had rooted my android phone... I know that there had been many threads about rooting this phone..but i am a little afraid about bricking my phone..that's why i am asking again..
The specs of my phone are given in the attachment...Please give a guide on rooting and unrooting my phone..
Akshit97 said:
Sorry, I know this is not the right thread to post this..
But i need help
I am a newbie and never had rooted my android phone... I know that there had been many threads about rooting this phone..but i am a little afraid about bricking my phone..that's why i am asking again..
The specs of my phone are given in the attachment...Please give a guide on rooting and unrooting my phone..
Click to expand...
Click to collapse
May be u should try using the search option next time...
but since u asked for it
http://forum.xda-developers.com/showthread.php?t=1606380
Really good guide mr.wilfred...
Want to ask something about compile and decompile apk from ICS version... what tool I need to compile and decompile it? And which version?
Thank you....
Sent from my GT-S5670 using Tapatalk 2
AldoSebastian said:
Really good guide mr.wilfred...
Want to ask something about compile and decompile apk from ICS version... what tool I need to compile and decompile it? And which version?
Thank you....
Sent from my GT-S5670 using Tapatalk 2
Click to expand...
Click to collapse
A seperate version of Apk tool has been made and i saw it few days back in xda only.... I would let u know if i get that link... ^_^
http://www.xda-developers.com/android/modified-apktool-for-android-4-0-4/
this is the one for ics apks
unable to compile using your method
Avilove.Cullen said:
unable to compile using your method
Click to expand...
Click to collapse
which are u talking abt.......apks dexes or jar files........
Avilove.Cullen said:
unable to compile using your method
Click to expand...
Click to collapse
Thn u would hav done any error....
btw... wat was the error u got...
Avilove.Cullen said:
unable to compile using your method
Click to expand...
Click to collapse
Hey Avi from personal experience,.. I found out something none of these guides tell us !
U need to put a file called aapt in apkmultitools/platformtools/ for u to compile properly in some computers,..!
I had an error which read as
java.io.exception : cannot run command [aapt ....blah blah blah]
if this is the same error,.. just put the right aapt file,..
also,.. to mod JELLY BEAN apks,.. all u gotto do is put the latest aapt that u can download using Android SDK,..
Havent tested whether it works .. but saw that some did succesfylly decompile using this method (no not in xda,.. in some other forum,.. )
I did all this and I get a folder with all the this stuff in it with smali extentions. I was wondering how do you actually look at the code of the apk and program it self. The reason why I want to look at the code is to see apps are written; the best way I know how to is by looking at code and figuring it out.
brievolz84 said:
I did all this and I get a folder with all the this stuff in it with smali extentions. I was wondering how do you actually look at the code of the apk and program it self. The reason why I want to look at the code is to see apps are written; the best way I know how to is by looking at code and figuring it out.
Click to expand...
Click to collapse
FYI smali's are dalvik opcodes... u can use dex2jar to view the smali in java language which is easier wen compared to smali... and to under these languages u would hav to learn java or hav xperience and interest too
need a recommendation for APK Tool
Hi, I have a i9305 SG3 using a custom ROM Jellybean Ver 4.1. I want to learn how to decompile, edit, and recompile code in my SystemUI.apk file. I know I need an APK tool/manager of some sort. However, after looking through your thread (and looking into other research on google) I wasn't able to find conclusive evidence on WHAT the name of a stable APK Program is and WHERE to get it.
*
I am using Windows 7 64x PC and want to learn how to edit APKs. I have appreciated reading your threads and hope to learn more. I need to find the right APK software to start with. Suggestions please....
droido123 said:
Hi, I have a i9305 SG3 using a custom ROM Jellybean Ver 4.1. I want to learn how to decompile, edit, and recompile code in my SystemUI.apk file. I know I need an APK tool/manager of some sort. However, after looking through your thread (and looking into other research on google) I wasn't able to find conclusive evidence on WHAT the name of a stable APK Program is and WHERE to get it.
*
I am using Windows 7 64x PC and want to learn how to edit APKs. I have appreciated reading your threads and hope to learn more. I need to find the right APK software to start with. Suggestions please....
Click to expand...
Click to collapse
Hey there..... Hello..... U can either use apk manager or apk tool to decompile nd recompile apk's ... But as far as i know ICS rom's had different dependencies hence a diff version of apktool wer required .... since your rom being jelly bean ,As a wild guess, it MAY hav certain problems as such in ICS's ROM's ..... The best solution is either ask a fellow dev from your community who has been decompilin/recompilin apps or else there's always a better partner ( google ) .....
Sent from my GT-S5670 using XDA
Hey wilfred for decompiling app from custom rom like cm7 should we still use stock framework first??
MajinSaiyan4 said:
Hey wilfred for decompiling app from custom rom like cm7 should we still use stock framework first??
Click to expand...
Click to collapse
nop.... use CM7 framework-res.apk !!!
wilfredcool007 said:
nop.... use CM7 framework-res.apk !!!
Click to expand...
Click to collapse
Ok thnx but i had problems recompiling systemUI.apk with apktool even without any modifications sry cant post error right now im on phone..
MajinSaiyan4 said:
Ok thnx but i had problems recompiling systemUI.apk with apktool even without any modifications sry cant post error right now im on phone..
Click to expand...
Click to collapse
Did u delete the public.xml before u could recompile ??? if so u wouldnt hav got any error.... to be on the safer side send me the error tat u get....
wilfredcool007 said:
Did u delete the public.xml before u could recompile ??? if so u wouldnt hav got any error.... to be on the safer side send me the error tat u get....
Click to expand...
Click to collapse
Uh is it necessary to del public.xml??ok i wil try when im on pc..actually i was trying jellybean layout mod but i was unsuccesful

I saw test version apktool_2.0.0b1.jar today

I saw test version apktool_2.0.0b1.jar today at http://miui.connortumbleson.com/other/apktool/test_versions/
Has any one tried it? It did not work for me. Please try out.
6/12/2013
Test version apktool_2.0.0b2.jar at http://miui.connortumbleson.com/other/apktool/test_versions/
SunnyOK said:
I saw test version apktool_2.0.0b1.jar today at http://miui.connortumbleson.com/other/apktool/test_versions/
Has any one tried it? It did not work for me. Please try out.
Click to expand...
Click to collapse
You need to rename that file apktool_2.0.0b1.jar to apktool.jar make sure to backup your original file just in case.
Confirm it's working to decompile nice it creates now separate folder for (META-INF) and (AndroidManifest.xml) so no need extract two files from the original apk file.
Edit: It seems not working compile files to apk.
Thanks
xxxSuperserieSxxx said:
You need to rename that file apktool_2.0.0b1.jar to apktool.jar make sure to backup your original file just in case.
Confirm it's working to decompile nice it creates now separate folder for (META-INF) and (AndroidManifest.xml) so no need extract two files from the original apk file.
Edit: It seems not working compile files to apk.
Thanks
Click to expand...
Click to collapse
Thank you for your quick response.
I usually use batch file. Originally, when I used Apktool_1.5.2.jar or earlier version, the command line reads
java -jar apktool_1.5.2.jar Contacts.apk New/ABC
It gets error: Input file (New/ABC) was not found or was not readable.
With Apktool_2.0.0.jar, the command line should be modified as
java -jar apktool_2.0.0.jar Contacts.apk -o New/ABC
Now, it is working for decompiling.
Are you successful to recompile the apk based on your decompiling?
I am still working on this. No success so far.
This apktool.jar contains aapt.exe (prebuilt/aapt/windows, etc).
SunnyOK said:
Thank you for your quick response.
I usually use batch file. Originally, when I used Apktool_1.5.2.jar or earlier version, the command line reads
java -jar apktool_1.5.2.jar Contacts.apk New/ABC
It gets error: Input file (New/ABC) was not found or was not readable.
With Apktool_2.0.0.jar, the command line should be modified as
java -jar apktool_2.0.0.jar Contacts.apk -o New/ABC
Now, it is working for decompiling.
Are you successful to recompile the apk based on your decompiling?
I am still working on this. No success so far.
This apktool.jar contains aapt.exe (prebuilt/aapt/windows, etc).
Click to expand...
Click to collapse
I have success decompile but compiling apk giving me error and have no success yet from there.
Will try when I get home.
Sent from my LG-LS970 using xda app-developers app
jonahly said:
Will try when I get home.
Sent from my LG-LS970 using xda app-developers app
Click to expand...
Click to collapse
What is your progress? Any success for recompiling?
SunnyOK said:
What is your progress? Any success for recompiling?
Click to expand...
Click to collapse
No
6/12/2013
Test version apktool_2.0.0b2.jar at http://miui.connortumbleson.com/other/apktool/test_versions/

Categories

Resources