Have you ever opened up a .smali and just starting bawling your eyes out? Of course you have - .smali code is a mess. Even with software that provides syntax highlighting, its nothing but CONST_V4 for at least eight million lines. The goal of this tut is NOT to produce editable source code. That is why "source" in the title is in quotes. What this can help with though, is translating .smali into a .java file, which is easier to read. You can then track down what you are trying to edit in the .java file, then have a better idea of where and what you are editing in the .smali file.
Lets get a few things straight right now before we begin to play
This TUT assumes you already know how to decompile a .apk and extract a .dex file
Read THE WHOLE POST. There will be a wall of shame for questions asked answered here.
It is illegal to decompile TW source code, try to edit it, and recompile it as though it was your own.
You will most certainly fail if you attempt to recompile this code. It is NOT true Java source, but is the decompiler's best guess at what it might be.
IF by some MIRACLE of whatever god you pray to allows the "source code" to compile, you WILL experience bugs.
I AM IN NO WAY, SHAPE, OR FORM responsible for what you do with this Tutorial. If you manage to in some way damage your phone, or if you get into legal trouble doing this, I WILL POINT AND LAUGH AT YOU, and that is the end of the conversation.
Dogs are better than cats - I can speak with authority on this - I own one of each, and love them both. But dogs rule and cats drool.
I am not a developer. This is a set of tools I use because quite frankly, I am no coder yet. It makes my life easier trying to track things down, and I figured I might as well share this with everyone.
I did not create the tools in this Tut. I found them and put them to good use. The original location of every file is linked in this post.
Now for the main event
You will need a specific set of tools. I am posting links to the tools here so you may read more about them, HOWEVER, at the bottom of this post I will have a zipped up toolkit that has all of it included. The tools are:
dex2jar
Java Decompiler
Notepad++
Some Common Sense
We will be using SystemUI.apk for this specific tutorial. That doesn't really matter at all, as this should work with any .apk.
Step 1 : Extract your .dex file:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Step 2: Using dex2jar, convert your .dex file into a .jar file. To do this, simply drag your .dex over:
You have now created your .jar file.
Step 3: Now, drag the .jar over to your jar decompiler:
This is what the result should look like:
Now, if you wanted to stop at this step, you absolutely can. From here, you can manually poke around inside the java files to find what you are looking for. BUT, that is not what I am here for. I am here to make your lives EVEN EASIER. Go get yourself a taco, and meet me here after the break.
Break time's over. Back to work!
Step 4: We now need to extract the .java files from this program. To do so, go to file/save all sources:
I would recommend saving that file as the name of the .apk you are working with:
Step 5: Extract that zip file you just created to its own archive, and then crack open the archive. You can now view your .java files in NotePad++. Here is the same file presented side by side; one is .smali, the other is .java. You can clearly see how things line up, and how much easier it is track things down in the smali:
Now for the final step to, and to bring it all home. Notepad++ has an incredible feature called Find In Files. So, lets say you are trying to find the color of a certain piece of text that is only declared in smali (or, ya know, whatever else it is you may wish to be screwing with), you can use find in files to select a folder, and then search for code:
I hope this has helped you; if it has, give that little thanks button a click. I also hope you have a good sense of humor about cats and dogs, and that you know how to enjoy a taco.
And now for the toolkit. By clicking show content you agree that you have read through both this and the Q&A, and that you agree to go on the Wall of Shame if you force my hand.
SmaliToJavaTutToolkit
PEACE!!!
This document may come in handy:
Q&A
As I get LEGITIMATE questions, I will answer them, and copy them here into one hub so you don't have to search through the whole thread.
Wall of Shame
If you ask a question that is already answered in the Original Post or in the Q&A section, I will post it here, for all to see, mock, and ridicule. It will be fun for me. YOU HAVE BEEN WARNED!
hello again, i forgot about it how do you convert it back to smali after editing?
I think we have our first wall of shame post!
Pretty sure you mentioned something about this in the op.
That's right, you did! In the OP!
"You will most certainly fail if you attempt to recompile this code. It is NOT true Java source, but is the decompiler's best guess at what it might be.
IF by some MIRACLE of whatever god you pray to allows the "source code" to compile, you WILL experience bugs."
Click to expand...
Click to collapse
Looks pretty sweet bro. Nice tut. I know I'm going to use this as a reference.
Sent from my SPH-L720 using xda premium
What is this for? Lol just kidding. Thank you do much for the tutorial!
Sent from my SPH-L900 using Tapatalk 2
Nice tutorial with pics! I thought it was kind of a given that people knew about this. Now if only the JD-GUI would decompile all of the source pieces in various files. Some you have no choice but to dig through smali.
digiblur said:
Nice tutorial with pics! I thought it was kind of a given that people knew about this. Now if only the JD-GUI would decompile all of the source pieces in various files. Some you have no choice but to dig through smali.
Click to expand...
Click to collapse
I managed to stumble into this one all on my own. I have always had a hard time with SMALI code. I can get into the xmls and do whatever I need to, and I can at least read java. It would be handy if it broke it down further, but at least its something to make more sense of what the smali is telling me.
Intentioal wall of shame (;
Can I decompile tw modify it and recompile?
Jk anyways nice tutorial. I absolutely love the simple steps. Years ago when I first tried this without knowing a thing about where to begin the tutorials were overly complex and vague.
Sent from my SPH-L900 using xda premium
ac16313 said:
Intentioal wall of shame (;
Can I decompile tw modify it and recompile?
Jk anyways nice tutorial. I absolutely love the simple steps. Years ago when I first tried this without knowing a thing about where to begin the tutorials were overly complex and vague.
Sent from my SPH-L900 using xda premium
Click to expand...
Click to collapse
OMG That's the best thread on the XDA
Can't convert .dex file into .jar file
burakgon said:
OMG That's the best thread on the XDA
Click to expand...
Click to collapse
Thank you so much for this TUT!
I have a problem with convert .dex file into .jar file. I drag the .dex file over the d2j-dex2jar.bat but nothing happen
Help me, please.
xxxb said:
Thank you so much for this TUT!
I have a problem with convert .dex file into .jar file. I drag the .dex file over the d2j-dex2jar.bat but nothing happen
Help me, please.
Click to expand...
Click to collapse
Oh wow, totally missed this post. Sorry man. Still trying to figure this out?
So, @forumber2 made a sweet little tool to do this for you.: http://forum.xda-developers.com/showthread.php?p=46457301#post46457301
Supper Rocks
absolutely amazing.
thank you very much
i have collected all informations tools and tested them to compile, decompile, edit, sign and your information to edit dex file to edit apk.
now all i have to do is to learn java programming, and i will start to download some video tutorial, that is much better than i ask people to help me out on how to do that and that, because lots time i come home with empty handed, but will learn java for sure, not just because editing apk, because i am interested in after effects and 3d animation software also website designer, so its a tools that will help me to survive.
thank you again MR.
how to convert
hello again, i forgot about it how do you convert it back to smali after editing?
thank you.
Wall Of Shame Nomination!
zindu said:
hello again, i forgot about it how do you convert it back to smali after editing?
thank you.
Click to expand...
Click to collapse
I think we have our first wall of shame post!
Pretty sure you mentioned something about this in the op.
That's right, you did! In the OP!
"You will most certainly fail if you attempt to recompile this code. It is NOT true Java source, but is the decompiler's best guess at what it might be.
IF by some MIRACLE of whatever god you pray to allows the "source code" to compile, you WILL experience bugs."
recompile java to .dex
I think we have our first wall of shame post!
Pretty sure you mentioned something about this in the op.
That's right, you did! In the OP!
"You will most certainly fail if you attempt to recompile this code. It is NOT true Java source, but is the decompiler's best guess at what it might be.
IF by some MIRACLE of whatever god you pray to allows the "source code" to compile, you WILL experience bugs.
I did start to learn some java codding, but it takes long time to learn, i am busy for this month but will continue to learn.
i believe in about 6 months i will know general information and move my head around java syntax and formulas.
what i am thinking is, i do not care if i can not convert it back because if i learn basic java and build apk, then i think it will be very easy to use decompiled apk resources as a source, what i mean is;
to rebuild apk to match my desire, then i be able to recompile it again, but it is all about programming, the only things is how files and commands are working and related to each other, that is why i am trying to learn java programming, i know its hard but i am trying.
---------- Post added at 01:02 AM ---------- Previous post was at 12:56 AM ----------
So it is easy to rebuild apk using and modifying existing code but first i have to learn a programming language.
xxxb said:
Thank you so much for this TUT!
I have a problem with convert .dex file into .jar file. I drag the .dex file over the d2j-dex2jar.bat but nothing happen
Help me, please.
Click to expand...
Click to collapse
check this folder "C:\Documents and Settings\<your windows username>"
Is there any java decompiler app for android i have decompiled my apk but i want a java file i dont have a pc
Sent from my GT-S6802 using Tapatalk 2
help
cant we directly decompile .smali files to .java source code????
if yes then please help....
I am currently writing an eclipse plugin that can read smali source files and replace the variable names in the corresponding java files.
This makes the work much easier.
It is currently in an alpha phase so come, try and improve please.
Github: https://github.com/Flamefire/ImportSmaliVarNames
Related
::EDIT:: This post may become a bit messy while i build it, but i promise to try and format it as much as possible to make it easier to read! If anyone finds anything inaccurate in this post please let me know!
A couple days ago i didn't think i would have the knowledge to be writing on how to theme for Android. But its amazing what you can learn, when you spend a good 2-3 hours reading on a subject.
If you haven't read How to Theme Develope for Windows for Dummies I would advise you to start there first.
This will basically give you an idea of where the files are that you can change. There are quite a bit of files that you can change and some you shouldn't, at least not until they are understood better. (i.e. any file with .9.png as the extension.) These are stretchable pics and can cause problems with your theme and phone if not done properly)
When you download a theme it looks and acts as if it were a full flash, but the truth is these files only contain what we need to theme. As people learn more about themeing Android, these files should become smaller and smaller. I will explain the folder structure of these update files to make things easier to understand, Below i even have screenshots of them. The best way to learn these folders and apks is to extract them and view them in the thumbnail view in Windows Explorer. I am sure you will find most if not all of the files familiar. When scrolling thru all of the png files see if you can figure out where they appear on your phone.
Folder structure: Folders and apks
Anyone who uses a computer should knows about folders.
apk files are like zip files or containers. They have folders and files inside of them.
There are many folders and files in the update.zip but we are only going to cover a few for now.
app folder - This folder contains all of the apps that will be installed during an update or wipe. You will need to extract only the apks of the apps you wish to change the icon and graphics for.
-Launcher.apk - This file is in the app folder and contains the menu launcher tab, clock, google search widget, wallpapers and some other things.
framework - This folder contains framework-res.apk, this is where the bulk of your editing will take place.
When you open a apk you will see:
assets - This will contain images, sounds and other content used by the programs. Not always used!
META-INF - This contain the encryption data of the update.zip.
res - This folder contains all of the png and xml files. The xml files are used to format the UI, these can be used to change the locations of things on the screen. The xmls need to be unencrypted first. Depending on the apk there can be a bunch of folders under the res folder but we will only concentrate on the drawable ones.
-drawable - The png files in this folder are displayed wheather the keyboard is open or closed. The majority of the files are here.
-drawable-land - These are the files that will show when the keyboard is open. There won't be as many files in these folders. Most of the time the programmer will re-organize the layout with an xml file.
Basically the interface of Android is a bunch of pictures, the program links these pictures to certain actions. As someone making themes you do not have to worry about any programming, in the future when people start unlocking the xml files to change the way things look. Then you will have to learn some programming, but for now we will only talk about changing the picture files.
Below are screenshots for the people who learn quicker visually:
To start off i grabbed the Windows 7 Beta 3.0 from Dave Da Illest 1. also assuming that you read the link above, you Should have WinRaR and it should be associated with zip files. If not then, right click the update.zip and choose "Open With..." and select WinRaR.
Now you should see this screen.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click the framework folder, you will see framework-res.apk.
Double click framework-res.apk and it will open a new WinRaR window.
You will want to extract these files, i normally extract them to the same folder as the update.zip. Now if you try to extract the whole update.zip you will receive errors. I believe it is because the file is signed. I am not sure how to unsign the whole zip, or if you would even want to.
This is what the folder with the extracted framework-res.apk and update.zip should look like.
Now you want to open the res folder and go into the drawable folder. If you are using Windows Explorer, change the view to thumbnails and you will now see all the files that Dave Da Illest 1 has changed.
To compare the files from JF's RC30 and any other theme you will need to download JF's RC30 v1.31 here. The folder structure is a bit different but easily figured out.
Inside the update.zip the structure is different, but that is only because the people who make these themes have only included the files you need. So when you flash a theme you are not reflashin all of the Android OS, radio and boot loader. you will want to double click system and then you will see the folders from the themes, tucked in with the OS and whatnot. The app folder is at the top like before and the framwork folder is in the middle somewhere. Follow the same instructions as before to extract the files, then tile your windows vertically or horizontally to do a side by side comparison.
It is best to create a folder specifically for these files. (when i first did this my folders were a mess and i ended up spending an hour or so editing a bunch of files, only to flash the original RC30 files on to my phone.)
::TIP:: When you open an apk file from inside the update.zip file, WinRaR may default to a temp folder...(i.e. C:\Documents and Settings\bobbyd\Local Settings\Temp\Rar$DI71.579\framework-res) double check the location of where WinRaR wants to extract files, this is how i ended up flashing the original files after spending a decent amount of time photoshopping.
I will update this thread as more ideas come in or as i read up on more, i am at work and just threw this together very quickly.
::EDIT::
I added themetemplate.zip, Its basically all the apps folders and framework-res.apk extracted with the folder structure intact. I stripped all .9.pngs and xmls out.
Included in the zip is:
update
-app
--AlarmClock
--Browser
--Calculator
--Calendar
--Camera
--Contacts
--Email
--Gmail
--gtalkservice
--IM
--Launcher
--Maps
--Mms
--Music
--MyFaves
--Phone
--Settings
--SoundRecorder
--Superuser
--Sync
--Talk
--Vending
--VoiceDialer
--YouTube
framework
-framework-res
inside each folder is the res\drawable, drawable-land, drawable-port
reserved....
Thanks for the clarification, It does help explain things a bit more. I plan to get started making a theme as soon as I get done downin' all the needed files. I have no internet besides my tetherbot for now, so it's a slooow process!
I figured i'd help by answering some of the questions i had and answered by playing with and dissecting the already created themes.
I didn't want to bother Stericson or Dave with questions they've been asked 100 times already.
WOW good looks.. looks like its time to make some themes..
is it possible to merge this with my how too ?? seems like it would be a great add on
Dave Da illest 1 said:
is it possible to merge this with my how too ?? seems like it would be a great add on
Click to expand...
Click to collapse
I agree.... doesn't mean a thing by itself but merged together with your thread, would give a great visual representation of what is going on.
Dave Da illest 1 said:
is it possible to merge this with my how too ?? seems like it would be a great add on
Click to expand...
Click to collapse
Maybe the mods can sticky this, but wait until i am done editing it? then merge it with your thread. Unless I can still edit it when it is merged =)
yea....how many how to theme threads do we need?....
Like the visual representations...
Stericson
i dunno maybe a mod can put ur post where my reserved spot is on mines .. im not sure if he can tho but i hope he could lol
Stericson said:
yea....how many how to theme threads do we need?....
Like the visual representations...
Stericson
Click to expand...
Click to collapse
I think as many as it takes =) Reading Dave's for dummies howto makes a lot more sense to me now. But last week when i read it i was confused as all hell! I basically put in a bit of info and some pics.
You guys will be thanking me when its all done...just think how many PMs it might save you from =)
If PM=">,last_week"
Then
Thank.damnitpud
End If
I'll merge the 2, the right way, as soon as both of the thread creators give me the ok.
you have my ok
is it possible to like make a list of which file controls what
example i was trying to find the clock images course i found that but other things theres like sooo much :|
also i was wondering does rc30 images differ from rc8 images (for the res and drawbles etc)
Mikey1022 said:
I'll merge the 2, the right way, as soon as both of the thread creators give me the ok.
Click to expand...
Click to collapse
Can you merge it so i can still edit it? if so i am ok with that to.
As far as I'm concerened you can merge all three.....maybye have each of our posts one after the other...will be a great place for information
Stericson
EDIT:
btw,
If PM=">,last_week"
Then
Thank.damnitpud
End If
^^^ Funny
This thread will be closed and placed to rest.
Please post all new comments or question in the new thread, placed here.
I've been slowly working on fixing a number of issues with apktool which will hopefully help some of you guys out with your theming/etc. As a first release, this is unlikely to be perfect and I have not really tested this latest build so please post any issues you have.
This is based on apktool 1.3.2 since that is the version with the source released (thanks Brut.all) which means there are some issues that weren't present in apktool 1.3.1. I'm far from an expert in reverse engineering and I haven't worked on any OSS projects before so this is really only meant to be a holdover until Brut.all picks the project back up. I believe he is waiting for the honeycomb source, but don't quote me on that. The name for this release is a bit of a misnomer since most of the issues were introduced with the Gingerbread SDK.
Anyways, onto the issues (hopefully) resolved:
- X-Large screen support (thanks fboldog)
- Multiple substitution strings
- Multiple substitution plurals
- Escape character issues introduced in apktool 1.3.2
This is meant for people already familiar with using apktool. See the apktool site for installation instructions
Update 5/13 - v1.1
-Renamed
-Fixed empty string error
-Included aapt from 3.1 sdk
This is great. Thank you!
Awesome! Not sure version I've been using, bignadad hooked me up a while ago for honeycomb. I'll be testing this one tomorrow when I get back to my comp.great work Sangreal!
Bazar617 said:
Awesome! Not sure version I've been using, bignadad hooked me up a while ago for honeycomb. I'll be testing this one tomorrow when I get back to my comp.great work Sangreal!
Click to expand...
Click to collapse
I've worked with bignadad on testing some earlier builds so it could be that. I also know bigrushdog has been working on his own fixes so it could be that too . Not sure about the status on that front
If it is the one I sent bignadad you should definitely upgrade to this one, as I've fixed a number of issues
I definitely will upgrade... the one I have works great for decompiling, couldn't use a recomiled apk tho. I'll report back tomorrow with how it works for me.
Xooming with Tapatalk
Getting verrrry near 100%. Decompiled perfectly (it was weird typing honeytool instead of apktool in cmd lol), compiled fine, I can now see the /xml folders in the recompiled apk, but still can't see the /values folders. One step closer tho.
I say that because there's some .xml's in the Values folders I want to edit and have to recompile. If theres anything I can do to help let me know (I'm not much of a programmer tho)
Thanks again!
the /values folder gets compiled into resources.arsc so you won't see it in the recompiled apk
As for the name, that would probably drive me nuts. I keep it as apktool locally, I just renamed it for distribution due to license
That does remind me though -- it should work with tools like APK Manager if you rename the jar to apktool.jar and replace the one that comes with the tool.
Sweet. The last build you shot me was real smooth. I'm gonna try this one out today. I've been sidetracked with a few other projects, so I haven't had much opportunity to focus here. Besides more and more HC source keeps dropping all the time. Soon we will have a solid smali which opens countless doors. Awesome job bro!
sangreal06 said:
the /values folder gets compiled into resources.arsc so you won't see it in the recompiled apk
As for the name, that would probably drive me nuts. I keep it as apktool locally, I just renamed it for distribution due to license
That does remind me though -- it should work with tools like APK Manager if you rename the jar to apktool.jar and replace the one that comes with the tool.
Click to expand...
Click to collapse
I was not aware of that. I'd say it's right at 100% then! But being in this business, you're probably thinking there's always room for improvement, I know I do lol.
So in theory I'd be able to edit something in the Values folder and use the .arsc file in the flashed apk and it'd show those changes? Just weary of taking steps no one else has (or is that how you did the UAstring mod?)
Yes, that is the theory. I did not use this tool though. I used fboldog's tool and manually fixed all of the compilation errors.
jim_panse was able to get it working using this tool though. See his thread here: http://forum.xda-developers.com/showthread.php?t=1064818
Didn't think of renaming the .jar, understandable about the licenses tho.
Looks like I've got a bit of trial and error in my path, thanks for the heads up! And thanks for the work on all this, we all appreciate it!
Wonderful work here!
Thank you very much for that
Sent from my Nexus S using XDA App
I have a problem, I edited the Stat_Sys_batt XML, recompiled, and pushed the framework back to my xoom but all it does is boot loop. Any suggestions?
Sent from my Xoom using XDA Premium App
That is probably a signature issue. Try copying the compiled xml into your original framework-res.apk and push that.
sangreal06 said:
That is probably a signature issue. Try copying the compiled xml into your original framework-res.apk and push that.
Click to expand...
Click to collapse
I tried that. The battery completely disappears when I do that. When I recompile the apk the first step says 'W: Could not find sources' could that be the issue?
Sent from my Nexus S using XDA App
What are you editing?
I just did a little bit in the framework, thanks for the heads up Sangreal!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
*Shutting Down
Bazar617 said:
What are you editing?
I just did a little bit in the framework, thanks for the heads up Sangreal!
*Shutting Down
Click to expand...
Click to collapse
I'm editing the battery and charging animations. I'm trying to add the honeycomb looking circle battery with 1 percent increments
Sent from my Xoom using XDA Premium App
I tried this a while ago and it didn't bootloop, it just didn't display the battery (I tried doing tenths just to test, because they have it set up to do like 15, 28, 43, 57, etc, don't know what they were smoking then...)
Are you in drawable/stat_sys_battery.xml? I'm not sure if editing just that file will enable it to work in values other than the ones in there (ie, going to your 1% increments), because I'm pretty sure it's being told to only look for those battery increments and those images.
And Sangreal, not sure if this is completely ready for APKmanager yet. If you edit in the Values/ folder, when compiling you have to delete the specific edited xmls + .arsc files mid way thru, which it doesn't show you in the keep folder.
however, I was able to make xml edits inside the Values/ folder in APKtool using CMD, compiled correctly (after a few tries of wanting to add an apostrophe, I think now needs to be \' ), and just copied the resources.arsc file in to my themed framework or systemui and Viola! I think I tried using the "unsigned" version straight out of being compiled and the Xoom definitely doesn't like it.
Theming a keyboard may be common knowledge to some of the amazing Devs here. But to a noob like me, it took some research and time to get it working without breaking the original signature (That's the trick!). I searched the forum and it doesn't look like anyone has posted a "How To" on theming a keyboard, so I thought I'd share my experience with you all.
**Some of these steps may seem elementary, but I tried to explain everything in layman's terms so even a beginner can theme a keyboard.
// Before you get started:
You must have a working environment setup. Check out QBKing77's awesome video "How to install the android-sdk" to get that going.http://forum.xda-developers.com/showthread.php?t=1614922
Make sure you also have installed:
Notepad++ (for editing xml) // (www.notepad-plus-plus.org)
7zip (for extracting apks) // (www.7-zip.org)
the image editor of your choice. I use Paint.Net(www.getpaint.net), and Gimp(www.gimp.org). Both FREE!
apktool (http://forum.xda-developers.com/showthread.php?t=1755243)
LatinImeDictionaryPack.apk (drop in the 'system\app' folder on your phone. Only for the LatinIME.apk) Grab it here: http://d-h.st/Ebb
// This method has worked with every keyboard that I have encountered so far. I will use 'LatinIME.apk' for reference, as that is the stock ICS keyboard. //
WARNING.. DO NOT POST DISTRIBUTION LINKS TO ANY MODDED 'Swype.apk'. XDA HAS A STANDING ORDER FROM NUANCE (MAKERS OF SWYPE), THAT DOES NOT ALLOW SUCH LINKS TO BE POSTED.
1) To start make sure you have a working copy of your keyboard apk; grab it out of a ROM, download it, or use a file manager with root access (like Root Explorer) to copy it to your SD card then to your computer.
**I would suggest dropping the keyboard apk into a folder on the desktop, seperate from anything else, and making a backup of the original so that you have a spare copy.
2) Using 7zip extract the 'res\drawable-xhdpi' folder into the folder you created. This folder will contain the pngs that control some of the keys, outlined in red on this pic:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Color these pngs to match using your favorite editor and save (bucket fill with Paint.Net is a breeze!)
3) Now that your pngs are themed.. Within the folder that you created containing your apk, hold down shift and right click. Select "Open Command Window Here" to fire up command prompt.
4) Next to decompile the keyboard apk with apktool (again using 'LatinIME.apk' for reference, but the apk may be of a different name; SamsungIME.apk, HTC_IME.apk, etc.).
Type this command:
Code:
apktool d LatinIME.apk
When it's done, you will see a folder with the apk name appear, within the folder you created. Click into it and you should see at minimun a 'res' folder and a 'smali' folder.
5) Navigate to 'res\values' folder. Depending on the keyboard you are working on, the xml controlling the remaining key colors will be contained in the 'colors.xml' or 'styles.xml' file. Open with Notepad++, and change the color codes as needed. Save and close.
6) Go back to the root of the folder containing your apk, and fire up command prompt (if it's not still open). Now it's time to build using this command (again using 'LatinIME.apk' for reference, but the apk may be of a different name; SamsungIME.apk, HTC_IME.apk, etc.)
Code:
apktool b LatinIME
7) When it's done building, you should have 4 folders minimum now (res, smali, build, dist) and it's time for the key to success. Navigate into the 'dist' folder and you will see the "Built" apk. Open it with 7zip, and extract the 'resources.arsc' file to your folder. Close 7zip.
8) Now it's time to pull it all together. Navigate back to the ORIGINAL keyboard apk, and open with 7zip.
Copy (you can drag and drop with 7zip) the 'resources.arsc' that you extracted from your "Built" apk, into the "ORIGINAL" apk overwriting the file. Then with 7zip still open and the apk loaded, navigate (within 7zip) into the 'res\drawable-xhdpi' folder where you should see the list of unthemed pngs. Simply drop your edited pngs into this folder. Close 7zip and you're done here!
9) Finally, take your "ORIGINAL" but themed apk, and push it back the 'system\app' folder on your phone.
Fix permissions to 'rw-r--r--' (only check everything under 'read' and Owner under 'write')
Reboot, and bask in the glory of your new themed keyboard!
**Alternatively, grab my empty zip installer here: http://d-h.st/oKG to flash in recovery. You must drop your themed apk into the system\app folder of the zip and save. Also, the zip already contains the 'LatinImeDictionaryPack.apk'
Please hit THANKS if I helped!! And please keep this thread alive!
Nice,
Now, we need a simple guide on how to theme Jelly Bean...all of it ... (tapping foot patiently)
Thanks!
Naddict said:
Nice,
Now, we need a simple guide on how to theme Jelly Bean...all of it ... (tapping foot patiently)
Thanks!
Click to expand...
Click to collapse
Themed the same just new xml and some new images. I got everything to decompile and recompile, just some of the xml's have changed.
---------- Post added at 09:41 PM ---------- Previous post was at 09:39 PM ----------
Thanks rompnit. I can there a whole Rom but always have issues with the keyboard. I'll try this tomorrow night.
Sorry i'm a nub but does the apktool jar file have to be in the same folder as android-sdk?
shehroze3 said:
Sorry i'm a nub but does the apktool jar file have to be in the same folder as android-sdk?
Click to expand...
Click to collapse
I actually created a folder 'C:\apktool' where I dropped everything, then added that folder to the Path system variable; same method as you would add the SDK. Otherwise, drop it into the 'platform-tools' folder within the android-sdk. When configured properly, you should be able to open command prompt in any directory, simply type 'apktool' and see a list of commands.
rompnit said:
I actually created a folder 'C:\apktool' where I dropped everything, then added that folder to the Path system variable; same method as you would add the SDK. Otherwise, drop it into the 'platform-tools' folder within the android-sdk. When configured properly, you should be able to open command prompt in any directory, simply type 'apktool' and see a list of commands.
Click to expand...
Click to collapse
ok i did what u said and put the apktool jar file into the platform-tool folder, but when i type apktool in cmd prompt nothing happens.
shehroze3 said:
ok i did what u said and put the apktool jar file into the platform-tool folder, but when i type apktool in cmd prompt nothing happens.
Click to expand...
Click to collapse
Did you also grab the "wrapper" script from the link as well? It contains a few more necessary files that go with apktool.
Sent from my SPH-L710 using xda app-developers app
time for dazed and rompnit to collaborate. maybe a simple guide for us wannabees...
recompiling never works for me, I read somewhere about empty folders being my problem...oh well, I can use 7zip though! and notepad+...
rompnit said:
Did you also grab the "wrapper" script from the link as well? It contains a few more necessary files that go with apktool.
Sent from my SPH-L710 using xda app-developers app
Click to expand...
Click to collapse
I'll check it out when I get home. Thanks
Sent from my SPH-L710 using xda premium
ok i got it to work. All i had to do was rename apktool_1.5.0 to apktool. I'm a noob, i know, try not to laugh to hard lmao
shehroze3 said:
ok i got it to work. All i had to do was rename apktool_1.5.0 to apktool. I'm a noob, i know, try not to laugh to hard lmao
Click to expand...
Click to collapse
Glad you got it to work!! And everyone has to start somewhere! Let me know how it turns out for ya!!
Sent from my SPH-L710 using xda app-developers app
Does this method work for both Odex and De-Odex ROMs??? I am currently on an Odex rom. Thanks!!
taihard said:
Does this method work for both Odex and De-Odex ROMs??? I am currently on an Odex rom. Thanks!!
Click to expand...
Click to collapse
This method will not work on .odex keyboard apk's, at least to my knowledge but I've always run deodexed ROMS. However, check to see if the keyboard apk you are working with even contains an odex file; a lot of them do not. If it does, you could always grab the apk off the web, mod it, and install it after removing the original files.
Thank you for the walk through, this is awesome
Hey Rompnit. Ok, I was having trouble getting apktool to run on my computer. That's what I was talking about on morphology anyway, so I was trying to learn how to theme an app and somehow was lead to morphology and got all caught up over there. Lol. But ya, I'm gonna have to crap clean my laptop to use this. Thanks. See ya over there
Sent from my Insanely Morphed S3 LI3 ktoonsez747 (196-2106) TW FreeGs3 2.0.0
rompnit said:
This method will not work on .odex keyboard apk's, at least to my knowledge but I've always run deodexed ROMS. However, check to see if the keyboard apk you are working with even contains an odex file; a lot of them do not. If it does, you could always grab the apk off the web, mod it, and install it after removing the original files.
Click to expand...
Click to collapse
This method WILL in fact work on odexed keyboards. Theming for an odex base is no different then a de-odexed base. You are not making any smali adjustments here so nothing that concerns the odex, thus it will not be affected.
Sent from my SPH-L710 using xda app-developers app
Guess no one was interested in theming an odexed keyboard after all huh? ....
Sent from my SPH-L710 using xda app-developers app
gruesomewolf said:
Guess no one was interested in theming an odexed keyboard after all huh? ....
Sent from my SPH-L710 using xda app-developers app
Click to expand...
Click to collapse
Guess not.. This thread's been quiet for a while... I guess people just don't want to theme keyboards in general!
Hey do you know if this process will work with keyboards from the market like SwiftKey 3? The themeson there are so boring need new colors lol
rompnit said:
Guess not.. This thread's been quiet for a while... I guess people just don't want to theme keyboards in general!
Click to expand...
Click to collapse
Guess that's what we get for trying to help. ... lol
Hi guys....
In this thread I'll try to learn you HOW TO MOD framework, settings (backgrounds, icons, colors) and how to use APKtool.
update 05/10/2013 !!!
O.K guys I found for you few excellent guides and tutorials.
Like always, post your questions here and we'll try to solve it together.
Update Zip creator/modifier
Great tool on windows to create and edit elements of updates zips
ADW Themes
If you want to create AWD themes - great tutorial...
I've got many PM from guys who want to theme their apps but dont't know where to look and what to modified so....read this.
this is a excellent way to find out where to look and what to edit.
Wanna learn more about XML files?
Well , here we go...
What is an XML?
Wikipedia link to learn and understand general things and facts about XML files.
you will need:
1) A computer
2) The app you want to edit
3) Latest Java Development Kit (JDK) (Download and Install with default settings Java
4) Notepad++ Notepad++
5) The Framework-res.apk and SemcGenericResUxp.apk from /system/framework
6) ZipSigner (for signe your apps) ZipSigner
So let's start...
Download APKtool from here Click me
Copy/extract APKtool to C:\Android\APK
Copy framework-res.apk and SemcGenericResUxp.apk from your system/framework folder to C:\Android\APK
and follow this tutorial to set your environment so we could proceed "Click me"
So, you set environment and we could proced ; (you'll have to do that from above only one time )
*** FIRST ONE ***
1. How to change settings background to white (or to use light theme - to be precise):
We'll start with this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
And end with this:
First copy settings.apk to C:\Android\APK
open cmd prompt ("SHIFT"+right click on empty space and select open command window here
...and write this to decompile settings.apk
apktool d settings.apk
Close cmd window and open newly created folder "settings" (it's in the C:\Android\APK)
Open \settings\res\values\styles.xml (open it with Notepad++)
You'll see this :
So..we have to add ".Light" to our style.xml file(to activate/select white theme) and we MUST change color to our fonts/text
to white (I guess it would be hard to read white text on white backgroung).
We will add ".Light" in every theme style and add ff000000 to set our text to black.
For example - on the left side is black settings and on the right is what we need - compare those two styles.xml.
You'll notice that I add word ".Light" to change this part/style to use light/white theme - we'll do that for every style in this file.
And the most important is third line on selected text - #ff000000.
With "#ff000000" we are telling our device to use black colour for text.
It's not hard at all....just continue to read.
You'll get all when you compare your style.xml to this one:
Here is complete style.xml , download it and compare this one with yours.
Just open both files and add ".Light" and "#ff000000" to every stile you see I've change.
https://app.box.com/s/ezd4k68li6g6f1mqp8u2
After you change all style in style.xml it's time for recompiling.
Again, open cmd prompt ("SHIFT"+right click) and write :
apktool b settings (without ".apk")
If you did all like you should you won't get any error.
Now open c:\Android\APK\dist
and you'll see settings.apk.
Copy it to your device
Wait......
It's not finished
As settings.apk is system app we have to sign it.
Open ZipSigner on your device and :
1.click "Choose In/Out...." - find and select your settings.apk (the one you just copied)
2.click "Key/mode": select "platform"
3.click "Sign The File"
........wait......
...and that's it, now just find your newly MODed and signed file and simple install it like any other app.
Next tutorial : how to change solid background colour to show your picture (any picture) in "calls" "email" "settings" clock" - MOD framework-res.apk....
Something like this:
Or even this...hahaha
update 05/10/2013 !!!
edit .9.png file correctly!
Remember, decompile apk and then edit .9.png files!
If you open the .9.png in the decompiled app and edit it with "Gimp" or "Photoshop" while leaving the pre-drawn boarder there, you'll be able to recompile the apk with a properly edited and themed .9png
How to edit smali files!
This is for advanced users or developers.
I'm still learning and trying to understand smali files so I won't trying to get smart ...
I'll share one great thread (TUTORIAL) and we could learn together.
tnx to @Yorzua for this awesome tutorial.
...and do awesome things like this :
SMALI editing TUTORIAL
Another nice tutorial for smali editing (beginners friendly)
SMALI editing TUTORIAL for beginners
I put this to the end of this thread purposely - editing or even understanding smali files isn't simple.
So go one step by step, don't try to edit smali files immediately after you learned how to decompile apk file - you'll failed and probably quit from any other MODing, theming or editing.
All great developers spent hours and hours to learn all this so you can't expect you'll know everything after 15min.
You'll get errors while compiling and decompiling and that"s perfectly normal, don't get angry...
Read what apktool "said" , fix your mistakes and move on.
It's very important to go step by step , especially when you trying to find bug.
Fix or edit line by line and compile after each part, compile and test app.
That's all for now guys...
see ya later
..............................................................
Tnx to: @niaboc79 (for tips and learning me some tricks) @abo hani (I used his settings.apk for screenshots) @Xda For many stuff
If I helped you - say tnx ...:thumbup:
if you need help...well just ask here
nice funky
GoodJob Funky
Tnx guys
Thanks guys...
It's not much and I hope you could understand what I wrote.
I just wanna give back something to this great community which gave me so much
Really nice tut
Just, please, guys when someone finish editing - let me know is it o.k, should I add something or you completed all without any problems
Tnx
Sent from my LT26i using Tapatalk 4
thanks very much for this easy tutorial, and yeah, it was way easier than others that i saw in some threads....
im bookmarking ur thread for now, and sure one day i'll be back and start up with practice
i love to mess around with the phone as i learned few things until i reach the level of an DEV (why not )
:good:
Tonight I'll post a tutorial for framework editing.
[HOW TO] change all backgrounds to your favourite picture.
In settings, email, clock, call....
Your background will stay there which ever settings or clock you using, you can change your settings.apk but your background will stay...
(as long as you don't change framework).
See ya tonight
Sent from my LT26i using Tapatalk 4
Actually.. Mate, when r u releasing ur work?? I'm looking for a bug free build of Honami settings.. Tried all of em in Themes secion.. Apparently they all have the stuttering when sliding for the fist time(just like in .200 and .211 builds).. Do urs too have it??
Hmm....mine work?
My work, for now , is helping guys in their ROMs.
I don't know that much to BUILD ROM from the sources.
So the question is do we really need one more rom based on stock 96?
I think we don't.
When I learn all stuff I need (and there's plenty stuff to learn - smali for example) I will build something.
But that won't be (most likely) for XS but for Z1.
Swipe settings, modified Home launcher will have all options like we saw in 2.0.5b.
Modified framework and many stuff more.
That's why I prepare everything.
I just don't wanna release clone of a clone...
If I can't make something really different I'll rather skip it for now.
Sent from my LT26i using Tapatalk 4
@funky0308, mate i've just learned how to use apktool and how to decompile and recompile apk, so can you post your " Next tutorial : how to change solid background colour to show your picture" hahaha thanks mate!
EDIT: or can you post a tutorial on how to make a transparent background on all of the apps. hehe ^____^
slink722 said:
@funky0308, mate i've just learned how to use apktool and how to decompile and recompile apk, so can you post your " Next tutorial : how to change solid background colour to show your picture" hahaha thanks mate!
EDIT: or can you post a tutorial on how to make a transparent background on all of the apps. hehe ^____^
Click to expand...
Click to collapse
I was planning to release it but it's almost impossible to genaralise tutorual because we have millions of framework.
I'll write one for stock firmware.
Sent from my LT26i using Tapatalk 4
funky0308 said:
I was planning to release it but it's almost impossible to genaralise tutorual because we have millions of framework.
I'll write one for stock firmware.
Sent from my LT26i using Tapatalk 4
Click to expand...
Click to collapse
haha. ok ok. thanks you again. i understand. im so excited about ur new rom. any changelogs already? haha. gudlak!
slink722 said:
haha. ok ok. thanks you again. i understand. im so excited about ur new rom. any changelogs already? haha. gudlak!
Click to expand...
Click to collapse
There is no my new ROM guys...
If you heard somewhere something you could only heard that I helped some guys.
There was some plans but as I said - nothing for now.
No sense to release same ROM or copy of the copy...
If I succeed on some things I'm working on - then I'll release something but only if I succeed.
Sent from my LT26i using Tapatalk 4
@funky0308 Im Studying Java and Smali.. I Know maybe 6% Already.. Buy suggestion on your case, if you want to port or to be themer. use Virotus Ten studio. It Can Generate the smali to java class. but you need to edit it on smali.
Tnx mate, very nice
Sent from my LT26i using Tapatalk 4
funky0308 said:
Tnx mate, very nice
Sent from my LT26i using Tapatalk 4
Click to expand...
Click to collapse
Mate? Im Getting Dizzyy. could you help me Changing it to white? my Settings// Im getting Crazy with my developments. Kernels + ROM.. Could you help me on my white? Setting
---------- Post added at 02:24 PM ---------- Previous post was at 02:21 PM ----------
Nvm.. Im Done.
How you change wifi and bluetooth on off switch????
Which file i need to edit to remove on and off in round switch
Sent from my ST21i2 using xda premium
I want to edit on off switch like you
Help me
AND also how to choose different backround color for on off switch
Sent from my ST21i2 using xda premium
Hello sir plz help me to port ios like on/off switch
I ported by editing framework-res.apk
And i have a problem
1.how to remove on off in round switch
2.how to change backround colour
To red
And how to resize it to correct round shape and small one
Sent from my ST21i2 using xda premium
Dear all,
I have recently managed to modify Lloirs SlimBean 3.1 rom to both update the apps and adjust the themes, so I thought I would take the time to share how this can be done with you all.
This guide will not tell you how to build a rom from source, but instead how to initially ruin the perfectly good rom someone else made, and then eventually customise it to your little hearts content without ever having to ./make it.
The intent of the guide is to cover
rom.zip File structure
apks & apktool
SystemUI and framework-res.apk
Anything amazing I haven't thought of yet
The first thing to realise is that both the rom file that you flash and the .apk files within it are all basically .zip files and can be opened using 7zip or other linux variants like fileroller. So if all you want to do is open up the rom and poke around, then I suggest you do just that. Its a great place to start to try and get your head around what is going on in there!
I have tried to do all of these modifications with the minimum install of tools and whatnot, as I like to be as close to what is actually being done as possible. There are a variety of all in one tools available, and a quick search of XDA will find them. In my experience these tend to become outdated quite quickly or development stops. So best to learn from the basics, which means the lowest level of tool possible.
With all that said I strongly recommend getting your mits on Gimp-2.8, fileroller and apktool.
Code:
sudo apt-get install gimp file-roller
Apktool can be found from the Git - repository or the google code site,
http://code.google.com/p/android-apktool/ I'll add install instructions and info on this tool in the specific section. There is also an excellent XDA thread covering the progress iBotPeaches is making with the tool.
http://forum.xda-developers.com/showthread.php?t=1755243
rom.zip File Structure
WIP
OK lets get started with the basics. Download a flashable rom.zip file and start poking your nose where it didn't belong before. If your ready yo get down and dirty just go ahead and unzip it into its own folder. Depending on what rom.zip you have will depend on how much of the file structure below you will see:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
and here we have the root of the flashable.zip starting from the top we have:
data: this contains anything that is already signed and not part of the original build but that we want to install with the rest of the rom
META-INF: Full of all the meta information you could ever dream of. This contains all the certification and signing files along with our most important file of the install script.
system: This contains all the files that actually make up our ROM so this is everything above the HAL (Hardware Abstraction Layer). In here are the goodies I will describe how to play with later.
boot.img: Is the all important kernel, if you are S-OFF this will flash on install, if not you will need to use fastboot to flash it separately.
So if your unhappy with all of this and want out of the woods already then you can just re-zip the files back together and they will work fine, no harm done. If not the lets move onto the easy folder data. I say easy because we can't break anything here, if you get it wrong then the packages here just won't install.
DATA
So as we can see above, we have a folder called app, which is full of a load of packages that I wanted to include into the rom, but and this is the important part. I didn't want this apps to be system apps, this means I wanted them to be easy to remove without using root access. As you will see system apps live somewhere else, not totally unlike the system/app folder :silly:. Another important point is that the apps/packages, I will use these terms interchangeably, that get installed from here are all signed, this means they have a signature in there meta.inf files saying that they have not been messed with. Most app developers will sign there work, to help keep it safe, and stop people from pirating it with such ease. All apps from the playstore are signed in such a manner. The apps in other folders must not be signed, but we will get back to that. If you have any apps or packages you have got the .apk from XDA thread or elsewhere this is one of the best places to put them if you want them to install with your rom.zip
So the truth be told, I have no idea what other folders you can put in aside from the app one, but I am sure there are plenty, if you find any let me know.
NEXT, we have the META-INF folder:
META-INF
Here as mentioned we have or CERT.SF which is a certification file, our MANIFEST.MF which is the manifest ie list of everything going into this rom, and CERT.RSA another signature file. DON'T BE MESSING WITH THESE. They are core to the install process, and generated by the build scripts used to create the rom in the first place. You can open and look at them all, which will help your general understanding and break nothing, however No saving the files.
Above is the full expanded file structure, again there is really nothing you want to mess with in here, but I'll explain what I know about them. First up is the:
Android folder files, which these cover the Over The Air (OTA) update information, this is just some data that identifies what version etc of the rom for what phone you are using. It used to make sure you get the right ota update, in this rom I haven't set up ota as I have literally no idea how.
google folders stashed in the second android folder are the updater files, this is effectively a list of what the recovery program is to do when installing the rom, so you will even find the lovely message that gets printed as your rom installs saying its all going well.
This leaves us with the most important of all the folders, the system folder. In here as mentioned before are all the golden nuggets that make the trove that is your rom. Lets take a peek.
As we would be hoping the folder is full of goodness! Taking it from the top we have:
SYSTEM
system/addon.d This contains shell scripts (Ones that would run in your terminal) here we have the 50 - slimupdate.sh slimupdate script, again for OTA but this backs up the hosts (I'll get to this later) file so that it is re-instated after the upgrade. Secondly we have the 81-aio_gapps.sh which backs up the gapps that you had installed before the ota update. So they can be put back afterwards. Feel free to open these look around, and if your not doing any ota they are pretty useless.
APP
system/app This is a very significant folder as it contains all the apps that will run as part of the system, in here you'll find the dialer phone.apk, the google search package velvet.apk, the google play store vending.apk and your text messenger mms.apk. All of these files are important, come unsigned as they used to be unavailable on the playstore, and for other important reasons I am unaware of. The important part is that when we start to think about editing them with apktool, or you make your own they stay unsigned them.
The system folder is protect as read only (-ro) so that these files are not available to be changed during normal use of the phone. Of course using esExplorer or another root explorer you can change the -ro mount setting to -rw allowing you to write to the folder as well, and so change the files.
I will be happy to answer any questions as to what .apk file relates to what if you are stuck at any point. You can remove and re-install these as you wish, but be warned remove the sytemUI.apk will result in very limited functionality on the phone, which is why I will be talking it up a bit later. Its also worth noting that different roms use different android versions of the .apk and they won't always play nicely together. Whats more some of the .apks are reliant on each other, for instance googles gallery.apk and camera.apk have cross funstionality, as do mms.apk, phone.apk, contacts.apk, and contactsprovider.apk, as they share usage and files.
BIN
Just like in your linux file directory the bin folder holds all the functions and programs that get called throughout the day to day use of android. As an example adb and the backuptool are in here. Again I would advise not messing with these files, but be aware that when your trying to add new packages or functionality to a rom you may find yourself adding files or functions in here.
/-- OK enough for now I'll get back to this --/
apks and apktool
OK so hopefully we now know where all the lovely .apk files are hiding within the file structure of our rom. Which don't get me wrong is nice enough in itself, but what we really really wanna do is open these bad boys up and start editing them just the way we like it.
The simplest way to do this is with 7zip or fileroller, you should be able to just double click pop them open, then navigate to the res folder where you will find all the folders with the .png and .9.png s for the gui systems in the app. If your using gimp or photoshop or pretty much any paint related software you can immediately go ahead and edit the .png files. The smart thing to do here is not to replace any files but edit and save them as the same resolution, as you may have noticed that the different res folders are separated into different resolutions and upright and sideways display. For the HOV most of what we want will always be in teh HDdpi or xHDdpi folders. Do Not Edit the .9.pngs As this will result in the failure later. This method is only really useful if your lazy, and only want to grey-scale a single image or what.
If you've got this far you probably want to be able to edit the .9.png s and start opening and changing the .xml code so that you can edit default backgrounds and text colours. To do this we will want the excellent apktool,
http://code.google.com/p/android-apktool/
This tool will unpack the .apk file and allow us to rebuild it as well, however it is rom specific to some degreee, as some .apks have been created using a different aapt file (Slim, some AOKPs) and so will require a more specific version. This may sound like a pain, but it can be dealt with super easily.
The slim one can be found here and has just recently been updated to handle Slim4.4 apks
https://github.com/SlimRoms/apktool
So how do I install, and then run these tools? How do I swap between slim and aosp or other .apktool versions?
First is first, download the version of the tools you want, either through direct link on the googlecode page or from downloading as .zip from the github page. Its worth noting that the latest apktool (v2) which works with java1.7 and can be downloaded from the github works slightly differently from the guide here, but its easy to work out how and is documented on the website.
I am going to assume we are too lazy to read the website, in which case stoppit go back read the website!
That done we can now run the install.sh script in terminal which will create an apktool folder where we can run the tool to our delight.
Importantly it should also put an aapt, apktool, and apktool,jar file into our /usr/local/bin/
Please note that any file structure starting with / is from the true root of the file structure whereas any with ~/ will be starting from your root folder in my case /mcgi5sr2/
This is one place where files go that you can execute anywhere within your file structure, so you can apktool anywhere in your file structure, please not that the decompiled files will always end up in your ~/apktool/<fileName>.apk folder.
So with this knowledge we can rip the aapt, apktool and apktool.jar out of the slimapktool, rename and put them in the /usr/local/bin/ folder for safe keeping. To use them in the heat of battle we simply rename the exisitng ones to 1.5 or 2 or whatever really, then change the name of the slim files back to aapt, apktool and apktool.jar . This way we can swap between them with ease. There are other ways of doing this, but they are beyond my ken (understanding).
OK so we are now installed, and can swap between apktool versions and have an apktool folder! We can really begin.
Delve into you rom or phone and pull out systemUI.apk from your rom/system/app folder and framework-res.apk rom/system/framework/ folder. This can also be done using adb
Code:
adb pull /system/systemUI.apk /apktool/systemUI.apk
adb pull /system/framework/framework-res.apk /apktool/framework-res.apk
Should do the trick, With some HTC roms ie stock you may find you need to also pull the htc-framework-res.apk. Once this has been done then one of the most important steps takes place. We extract the file framework for the rom so that we can decompile and recompile successfully for the phone. From within the same folder as the systemUI.apk and framework-res.apk on your computer type:
Code:
apktool if systemUI.apk
apktool if framework-res.apk
this will create a framework folder within ~/apktool/ which should contain a 1.apk and normally a 127.apk these are SUPER important let them be.
Finally it seems we are ready to decompile the .apk file we wanted to edit, a good place to start is the phone.pk or mms.apk so move the file wherever, I use the ~/apktool/ folder for all this craziness. Then type:
Code:
apktool d mms.apk
The magic should happen and you will have a ~/apktool/mms folder! In which is basically a lot of the same stuff in the unzipped version we talked about earlier. This can be edited to your delight and then recompiled, in fact its worth recompiling immediately to check it all works, nothing more annoying than spending a long time working in your res and values folders only to have it not recompile! So,
Code:
apktool b mms
Note the fact that the .apk is no longer present this is because we are building using the folder as source.
We are not done! We need to make sure the certification and signing is all correct, so we need to open the original .apk file, and extract the AndroidManifest.xml and the META-INF folder and replace the ones in the ~/apktool/mms/build/apk/ folder this will make sure we have the original signatures. Then we
Code:
apktool b mms
one final time, now the finished mms.apk should be in ~/apktool/mms/dist/ folder ready for use in the rom.
Once decompiled not only can we edit the .png files in the res/drawable folders but we can edit the .9.png files and the .xml and if we are really know what we are about the .smali files. I strongly recommend staying away from smali unless you really know whats up. There is an important rule to follow when editing .9.png files as well, that you should not alter the black lines that surround the edges. Everything else can be edited bar them.
As you can see above these lines normally only a pixel or so wide, but play an important role in how the files are used, stretched, repeated etc. In fact in some cases I have found that even using black (rgb ff000000) caused problems so I used just off black (rgb ff010000). The RGB codes used in the .xml files are also slightly different to normal, the first two digits represent how transparent the colour is with ff being solid, and 00 being transparent.
.xml files of interested will undoubtedly be found in the /res/values folder, as this is where most of the colours are defined.
There are a lot of things that can go awry in this, but if you follow these instructions you should be cool. Any issues you can try me, or go for the mega thread on apktool listed at the top.
A few pointers on what you'll find in the different folders once you've decompiled the .apk can be found in the post below about SystemUI.apk and Framework-res.apk
SystemUI and Framework-res
reserved to cover these special apks
Forgotten Isle
reserved for any new important things I may want to tag onto the en of this
File Structure
Also reserved...... for a reason yet to become apparent
Awesome work mcgi5sr2. This guide is really useful..
MScorporation95 said:
Awesome work mcgi5sr2. This guide is really useful..
Click to expand...
Click to collapse
I'm pretty busy right now, but will try and finish this for anyone else who is interested. I would add a build guide, but there are a lot of those out right now anyway.
If people are interested we could start a build and build errors thread for Primo to help each other out
Thank you!!!
---------- Post added at 09:01 PM ---------- Previous post was at 08:55 PM ----------
Very good guide
Sent from my One V using XDA Premium 4 mobile app
HTC ONE V reflash from *ZIP
hi, could you suggest me how to flash from ZIP(official EU ROM, downloaded from htc dev site), and I won't to change below mentioned?
* bootloader - LOCKED
* have orig. ROM but UK oriented
vinm07 said:
hi, could you suggest me how to flash from ZIP(official EU ROM, downloaded from htc dev site), and I won't to change below mentioned?
* bootloader - LOCKED
* have orig. ROM but UK oriented
Click to expand...
Click to collapse
You have to unlock your bootloader and install a recovery to flash a rom.