Related
If you have tried to edit .9.pngs in the res/drawable folders, then you know the reason for this thread. If you have not, the idea is that .9.pngs do not have a static boundary. Instead the boundary is given by a continuous mapping
b:[0,1) --> R^2
wherein the mapping is defined by guides which cannot be seen in regular graphical editing programs. This will give the basic idea, along with an example of how this works.
What you will need:
1.) draw9patch (found in /tools of the Android SDK: http://developer.android.com/sdk/index.html)
2.) gimp (or equivalent graphics software)
3.) Java 1.6 (not 1.5)
4.) Eclipse 3.5 with ADT 0.95 (Setup to compile android 1.6. Instructions: http://developer.android.com/guide/developing/eclipse-adt.html) It is assumed you are comfortable with eclipse. There are many threads on setting up eclipse, along with the linked instructions, so try and keep eclipse questions in this thread to a minimum.
Step-By-Step
1.) Find your desired file to edit, which from here on will be referred to graphic.9.png, and rename to graphic.png.
Reason: We will open the file in gimp (or an alternative .png editing app) which will not recognize the .9.png, and will open as .png. This will cause the invisible guides to open as filled in, and thus the guides will need to be redefined before we save. If we open a .9.png extension in draw9patch, it will assume the guides exist, which of course will not if we edit in another application, and thus not be added. By changing the extension to only .png, when opening in draw9patch, the guides will be re-added.
2.) Open graphic.png in gimp and do your desired editing.
3.) In your computer terminal enter draw9patch (assuming you added /tools to your path, otherwise in the terminal navigate to /tools in the AndroidSDK and enter draw9patch). Possible Issue: If draw9patch comes up blank with no menu, you do not have Java 1.6 set as default. Fix this via sudo update-java-alternatives -s java-6-sun in the terminal (or something similar for your system).
4.) Drag and drop graphic.png into the resulting draw9patch window. What you will now see is your image, along with transparent lines which will be where your guides are defined. One should read this http://developer.android.com/guide/developing/tools/draw9patch.html, though it is not that clear. Draw9patch allows you to add/remove black squares which define the actual guides. I will admit that this is one part of the process that I am still not completely comfortable with, and sometimes requires a little trial and error. Here is what I have figured out:
(i) You will want to draw a solid black line along the bottom and right edges of your image. This designates the boundary which results from the region which is stretched.
(ii) You will now add black squares to the top and left sides. These designate the solid part of the region that will be stretched (as opposed to staying transparent).
As I stated before, this part is a little confusing, but with some trial and error, anyone can figure it out. See my following example to witness the guides being used.
5.) After the guides are defined, save the file in draw9patch. This will automatically append .9 to the filename, and give an actual .9.png file that has been edited (now called graphic.9.png). We are not quite done though, because as is, the guides will not be recognized by the android OS. The images need to be compiled in eclipse as part of an apk.
6.) Open Eclipse and create a new project. You can name it anything you like, and you can just uncheck defining an activity. This project will automatically generate a res/drawable (or res/drawable-hdpi) folder, in which you will drag and drop graphic.9.png. From here, right click on your project, choose "Android Tools", and "export unsigned android application".
7.) In step 6 an .apk was created (I choose to save to desktop), extract the files, and open the folder in which graphic.9.png was placed. This is your newly edited, ready to use .9.png. Enjoy and have fun theming.
Example: How to change the outline of the inner squares on the power widget from orange to white.
1.) I take the file appwidget_inner_focus_c.9.png (found in Settings/res/drawable) and rename to appwidget_inner_focus_c.png.
2.) Open in gimp (figure_1) and change color to white (figure_2).
3.) Open draw9patch
4.) Drop appwidget_inner_focus_c.png into draw9patch (figure_3) and define guides (figure_4). In fig.3 the purple color is showing where the patch will be applied (i.e. where the stretching will occur). After I define the guides, (fig.4) note the vertical and horizontal green lines with signify the only color stretching will be along the boundary itself.
5. Save the image as appwidget_inner_focus_c.9.png (anywhere you like).
6. Drag and drop the file into the res/drawable-hdpi folder in your project folder (navigate to through regular computer file browser). Note that it is in the correct folder (fig.5). Right click on the project (in my case Aaron) and choose Android Tools, the export unsigned android application. Aaron.apk now appear on my Desktop (I chose desktop to export to), which I extract my appwidget_inner_focus_c.9.png from.
7. I am now done.
You don't actually need to use the draw9 tool. You can use your favorite photo editing software, whether it be Photoshop, Paint.net or GIMP and you can just add a 1px wide black border where needed and it works just the same.
Of course if you download the source from cyan's github then you can edit them from there, the source code is unprocessed so it still has the 1px black border around it. To me this is the easiest way to do it, then you don't have to worry about where you place the lines, they are already there.
After you edit, then you still need to do the above in eclipse.
jairomeo said:
You don't actually need to use the draw9 tool. You can use your favorite photo editing software, whether it be Photoshop, Paint.net or GIMP and you can just add a 1px wide black border where needed and it works just the same.
Of course if you download the source from cyan's github then you can edit them from there, the source code is unprocessed so it still has the 1px black border around it. To me this is the easiest way to do it, then you don't have to worry about where you place the lines, they are already there.
After you edit, then you still need to do the above in eclipse.
Click to expand...
Click to collapse
Wow, that is much easier, thank you.
Is it necessary to do step 6?
I find out the answer yes
Ok. So, everything was going great, but I ran into a problem. I am able to edit my .9.png's just fine. However, when I "export unsigned android application" in Eclipse I get an error that the package does not exist. Looking closer I see that one file in the package explorer has a little sqaure 'x' by it. If I delete that file it works perfectly, but I want that .9.png to be in there. Any clues on why this would happen? Any help would be greatly appreciated. Thanks for the great tutorial by the way. After you edit so many .9.png's you get a little used to it and it's really easy.
athanos said:
Ok. So, everything was going great, but I ran into a problem. I am able to edit my .9.png's just fine. However, when I "export unsigned android application" in Eclipse I get an error that the package does not exist. Looking closer I see that one file in the package explorer has a little sqaure 'x' by it. If I delete that file it works perfectly, but I want that .9.png to be in there. Any clues on why this would happen? Any help would be greatly appreciated. Thanks for the great tutorial by the way. After you edit so many .9.png's you get a little used to it and it's really easy.
Click to expand...
Click to collapse
Thats usually caused by a bad 9patch. The 1px marquee around the real image can only contain full transparent pixels our full opaque pixels (the patch guides).
Open your png with gimp/photoshop/whatever and look into that area to see if there's something painted.
athanos said:
Ok. So, everything was going great, but I ran into a problem. I am able to edit my .9.png's just fine. However, when I "export unsigned android application" in Eclipse I get an error that the package does not exist. Looking closer I see that one file in the package explorer has a little sqaure 'x' by it. If I delete that file it works perfectly, but I want that .9.png to be in there. Any clues on why this would happen? Any help would be greatly appreciated. Thanks for the great tutorial by the way. After you edit so many .9.png's you get a little used to it and it's really easy.
Click to expand...
Click to collapse
If you look at the errors it will tell you which file is bad and even if it's the top, bottom or sides that have a bad pixel in the border.
if someone want to help me how to do this on msn pleas PM me , im noob on eclipse
Why is the Eclipse part needed? I have no problem compiling my apk without doing that.
This thread is quite old. Apktool (my signature) is able to properly decode 9.png files - it adds borders where they should really be. Don't waste your time on adding them by hand.
can you be more precisly?
how to handle for example with the genie.widget?
there are 3 9.pngs included which i want to edit....
pa.pn2 said:
can you be more precisly?
how to handle for example with the genie.widget?
there are 3 9.pngs included which i want to edit....
Click to expand...
Click to collapse
you would do each 1 as presented earlier.
copy all 3 to main workspace used for eclipse and export unsigned.
then you need to replace the .pngs within the widget.
if its not a system ul most likely have to sign the app aswel.
may have to look around for how to do this
Someone correct me if I am wrong.
But I came upon this piece:
osdir.com/ml/Android-Developers/2011-01/msg00529.html
The format is standard PNG. Build tools add a custom chunk containing patch data.
Click to expand...
Click to collapse
So you still need to patch the .9.png and that is done as one part of the build process. (step 6)
Is there a more direct way of doing it?
dabicho said:
So you still need to patch the .9.png and that is done as one part of the build process. (step 6)
Is there a more direct way of doing it?
Click to expand...
Click to collapse
No, aapt is only one tool, which does borders -> 9patch chunk conversion and it always works on a whole project, not single PNG. But it should be quite easy to create such tool - I've already done 9patch -> borders converter in apktool.
Much easier way to compile 9patch without Eclipse. Post #11.
http://forum.xda-developers.com/showthread.php?t=816412&page=2
cloverdale said:
3.) In your computer terminal enter draw9patch (assuming you added /tools to your path, otherwise in the terminal navigate to /tools in the AndroidSDK and enter draw9patch). Possible Issue: If draw9patch comes up blank with no menu, you do not have Java 1.6 set as default. Fix this via sudo update-java-alternatives -s java-6-sun in the terminal (or something similar for your system).
Click to expand...
Click to collapse
what if it doesnt come up at all?????
I have everything installed the way it should :
Android SDK (updated)
Eclipse
ADT Plugin
Java SDK 1.6
Here is the message that I get on my terminal (using mac)
Code:
imad-zianis-macbook-2:tools Juevani$ ./draw9patch
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jdesktop/swingworker/SwingWorker
at com.android.draw9patch.Application$1.run(Application.java:48)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
imad-zianis-macbook-2:tools Juevani$
Check this out for swingworker-
www.google.com/m/url?channel=new&cl...8QFjAD&usg=AFQjCNGOD3KbL8SfFArOUOHWRzT0CQZezg
dully79 said:
Check this out for swingworker-
www.google.com/m/url?channel=new&cl...8QFjAD&usg=AFQjCNGOD3KbL8SfFArOUOHWRzT0CQZezg
Click to expand...
Click to collapse
You sir are a life saver thx alot
Ok, I just can't figure this out. I am going insane trying to figure this out. this is what I got so far:
I've installed the Eclipse, SDK, java, ADT etc....
I managed to modd my images with photoshop and put it through Draw9patch and managed to save my images to the folder of the app I was modifying. I opened up Eclipse and did the steps of: File\New\android project\ create project from existing source. and the part where you should use the default path for the directory. I can't seem to get to the end where I can pick "finish" to move on to the editing.
I did something different and managed to get the 9 pngs normal wthout stripes or marks and into a Res folder.
Ok, the part where you have to Export it is the sticky part. Can you please break down that section a bit more detailed. I got it to Unsigned App Package and I put the apk file on my phone all of a sudden my app was gone on the phone....Ok I modded the calculator with my images and can't seem to get installed.
johnny quest said:
Ok, I just can't figure this out. I am going insane trying to figure this out. this is what I got so far:
I've installed the Eclipse, SDK, java, ADT etc....
I managed to modd my images with photoshop and put it through Draw9patch and managed to save my images to the folder of the app I was modifying. I opened up Eclipse and did the steps of: File\New\android project\ create project from existing source. and the part where you should use the default path for the directory. I can't seem to get to the end where I can pick "finish" to move on to the editing.
I did something different and managed to get the 9 pngs normal wthout stripes or marks and into a Res folder.
Ok, the part where you have to Export it is the sticky part. Can you please break down that section a bit more detailed. I got it to Unsigned App Package and I put the apk file on my phone all of a sudden my app was gone on the phone....Ok I modded the calculator with my images and can't seem to get installed.
Click to expand...
Click to collapse
I do it this way:
1) get the .9.png files from the apk
2) redo the patches using draw9patch, save as .9.png
3) "compile" (process) the edited .9.png files with xeudoxus's xUltimate Draw9Patch Compiler. get it from here
4) put the processed .9.png files back in the apk
The compiler removes the 1 pixel border defining the patches that are stretchable and puts that info in the png as metadata (not 100% sure where)
hi there! so i'm following this thread's tutorial re using photoshop for ninepatch creation, and i'm getting lousy results. first attachment is the screenshot of the results (ignore the close bar, i copied that from xHero for now), the other two are the .9.pngs i made for use.
i used the cyanogenmod 5 stock pngs as reference for the border locations. i also apply the imgs using metamorph for now instead of running eclipse.
how do i fix these?
(running stock cm 5.0.8 on droid looking to theme it)
Did you compile the files in Eclipse?
i just said i don't run eclipse at all. if creating a ninepatch absolutely requires use of eclipse i'll do it, but i was under the impression i could skip eclipse for it.
I would suggest using the draw9patch tool in the android sdk and making a quick app in eclipse. Making an app with the image in eclipse makes the guides transparent when you use it in your rom and/or theme.
You NEED to compile the images which is what Eclipse will do for you.
Edit: Here, went ahead and did them for you. Didn't mess with the images, only compiled them.
Need to compile in eclipse. I just use a sample application from the SDK and quickly throw my images in and compile. Photoshop works just fine for .9 images, but if you want to preview it before compiling, use draw9patch.
@jaguirre - the compiled imgs work, thx!
now to install the unwieldy behemoth that is eclipse...*sigh*
neologix said:
@jaguirre - the compiled imgs work, thx!
now to install the unwieldy behemoth that is eclipse...*sigh*
Click to expand...
Click to collapse
actually guys. if you go to the website below and download xUltimate Draw9Patch Compiler you don't need to use eclipse! You just dump your images into the right folder and it automatically compiles them with its .bat file. really easy, i even tested it myself. he even gives you example .9.png's in three different folder with three different names. basically they are all on your desktop. all you do is run the xultimate program that comes with the draw9patch compiler and it automatically takes whatever .png's that are in your specific folder such as "Example 1" and creates a new folder called "done" and it has the new "Example 1" folder inside there with the compiled .9's.
http://www.droidforums.net/forum/xeudoxus/47283-release-xultimate.html
opasha said:
actually guys. if you go to the website below and download xUltimate Draw9Patch Compiler you don't need to use eclipse! You just dump your images into the right folder and it automatically compiles them with its .bat file. really easy, i even tested it myself. he even gives you example .9.png's in three different folder with three different names. basically they are all on your desktop. all you do is run the xultimate program that comes with the draw9patch compiler and it automatically takes whatever .png's that are in your specific folder such as "Example 1" and creates a new folder called "done" and it has the new "Example 1" folder inside there with the compiled .9's.
http://www.droidforums.net/forum/xeudoxus/47283-release-xultimate.html
Click to expand...
Click to collapse
If I didn't like to make ugly ADW.Themes I would get rid of Eclipse.
neologix said:
@jaguirre - the compiled imgs work, thx!
now to install the unwieldy behemoth that is eclipse...*sigh*
Click to expand...
Click to collapse
I suppose coming from many years of coding using notepad or IDE's without built in syntax recognition, its hard for me to call Eclipse an unwieldy behemoth. I have certainly seen some grungy environments out there from the open source community.
I don't mind it, but compared to Visual Studio 2008 (or 2010), its ugly and takes up significant retail with stock config. VS2008/2010 has sex appeal for sure.
Please read this whole thing before you reply!
I am trying to edit the battery icon XML files in framework-res.apk. Awhile ago I found a tool that would convert from binary XML to human-readable XML and back again, but for the life of me I cannot find it again.
Anyway, I opened stat_sys_battery_charge.xml with it and all was good, except it mentioned weird names for filenames. Eg instead of 'res/drawable-hdpi/stat_sys_battery_0.png' it was '89845b4jrqyuq34gy34q89tyq34' (or some gibberish like that).
I understand everything up to this point. I understand why those names are encoded like that. What I don't understand is how people figure out these codes. I have been using someone elses framework-res.apk as my base, and they use "v4" folders. Eg 'drawable-hdpi-v4' instead of 'drawable-hdpi'. These filename codes in the XML value were generated for this V4 folder, correct? How did they do that?
I do not want to use a V4 folder in my theme if I can avoid it. If I have to, I still have a problem as to how to correctly point to my battery icons. And no I cannot just replace the PNGs because my changing icons have more frames than the stock XML allows.
Any help would be extremely appreciated. Thank you.
TheLynxy said:
Please read this whole thing before you reply!
I am trying to edit the battery icon XML files in framework-res.apk. Awhile ago I found a tool that would convert from binary XML to human-readable XML and back again, but for the life of me I cannot find it again.
Anyway, I opened stat_sys_battery_charge.xml with it and all was good, except it mentioned weird names for filenames. Eg instead of 'res/drawable-hdpi/stat_sys_battery_0.png' it was '89845b4jrqyuq34gy34q89tyq34' (or some gibberish like that).
I understand everything up to this point. I understand why those names are encoded like that. What I don't understand is how people figure out these codes. I have been using someone elses framework-res.apk as my base, and they use "v4" folders. Eg 'drawable-hdpi-v4' instead of 'drawable-hdpi'. These filename codes in the XML value were generated for this V4 folder, correct? How did they do that?
I do not want to use a V4 folder in my theme if I can avoid it. If I have to, I still have a problem as to how to correctly point to my battery icons. And no I cannot just replace the PNGs because my changing icons have more frames than the stock XML allows.
Any help would be extremely appreciated. Thank you.
Click to expand...
Click to collapse
Well I'm using apktool for decompiling and I'm also trying to add some icons so maybe the help Daneshm90 has given me can help you Apkmanager
EDIT: Lol you didn't even write you were trying to add icons It is seriously stuck to my brain xD
Does apktool let you change the paths for the filenames in XML files, and correctly re-encodes it when you compile it back? I have been trying desperately to get apktool to work for me, but it just refuses. I'll have to try it on another computer or perhaps a VM then.
If apktool does not correctly handle paths, is there any tool that can? From what I've read, its impossible, but there must be a way!
TheLynxy said:
Does apktool let you change the paths for the filenames in XML files, and correctly re-encodes it when you compile it back? I have been trying desperately to get apktool to work for me, but it just refuses. I'll have to try it on another computer or perhaps a VM then.
If apktool does not correctly handle paths, is there any tool that can? From what I've read, its impossible, but there must be a way!
Click to expand...
Click to collapse
What do you mean by "paths in XML files"? Apktool decompiles XMLs fully, so you could do everything that you could do with your own app/sources.
To get started, read the posts below by tsachi.
Then give this a glance - Do it yourself guide for theme editing
More Resources:
http://forum.xda-developers.com/showthread.php?t=982300
https://docs.google.com/Doc?docid=0AcdxIJRSH9ypZGZzc2pxNDlfMjdnazk4OHNxZA&hl=en
http://forum.xda-developers.com/showthread.php?t=916814
Info on how to edit the items in notification bar:
+ http://forum.xda-developers.com/showpost.php?p=11158662&postcount=3
All credit belongs to the original authors. I am simply gathering all this information to make it easier.
For any help or support, post in this thread and we will try to help you the best we can.
Expanded Information
Introduction
The link in OP gives you instructions on how to replace images, but it lacks information for the inexperienced themer. Here is some background information and some more details on the steps before and after you insert new images in your framework.
System Icons and background images sit in two main files: framework-res.apk and twframework-res.apk. Within these files there is a res directory, and under that you have the folders containing data. Google has guidelines on icon design, although themers usually ignore those in order to get a different from stock look. One thing you would notice is that there are a lot of repeated icons. For example, framework-res.apk has both drawable-hdpi and drawable-hdpi-v4. The first is there for compatibility with older APIs (anroid 1.6 or older) so I am not sure why it is still there, but if you remove it your phone will not like it.
Each application has its own res folder where the launcher icon and other visuals are kept. There are, however, a lot of applications that reference the framework.apk for visuals. An example is the dialer that calls on some background images from both framework-res and twframework-res.
There are 2 types of images that you would encounter. Normal icons and images are non-scalable. They take a certain amount of real estate on the phone, and that’s it. Example of these are the battery levels and notification icons. The other type is the .9 images. These are images that are going to be stretched to fit whatever space is needed. An example of that are the menu backgrounds. The .9 images have a special format. The one pixel border around them defines how they stretch and how content is displayed in them. It is highly recommended to follow the standards in order to get repeatable and consistent look. Android SDK has a tool to help with .9 file design: draw9patch.bat.
Important note: The .9 files show the borders ONLY when de-compiled. If you grab a file from the framework directly you will not see that line. It is therefore required to compile the .9 files after you make them. You can use apk manager or ThemePro-JAVA to recompile the framework apk after modifying the files.
Definitions for which image is used where sit in the xml files under the drawable folder. These are compiled xml files, you can’t edit them with a text editor. For this introduction I will not go into modifying xml files. Each apk also has a resources file that describes what is in there. If you add, remove, or rename files in the apk you will have discrepancy with the resource file and the theme will not work (more likely you will be stuck in an infinite bootup loop)
Before you start:
Warning: frameworks are highly linked with other files. You can’t just take a framework from one ROM and put it in another. Always keep a backup of the original files ready to be installed (see below), otherwise you may need to re-flash the ROM. Frameworks are also sensitive to compression. DO NOT use winzip to handle the files, it can cause problems with the final apk file.
There are several things you would need before you start
A rooted phone
SDK installed on the computer
A zip handling software other than winzip (winRAR and 7-zip are both good options)
Auto-sign (http://forum.xda-developers.com/showthread.php?t=471634) or signing tool (http://forum.xda-developers.com/showthread.php?t=473580)
Create a backup
Grab the framewor
k-res.apk and twframework-res.apk from your phone. They are located in the system/framework folder. You would need them as a starting point for your modification and you need them for a backup
Create a clockwork installation file of the original files (see post below)
Name the installation framework-original.zip, or something else that would be easily recognized in
case of trouble, and then copy it to your internal sd card.
After you are done modifying files
Create an installation file (see post below)
Give the file a name that is easy to recognize and copy it to your internal sd card
Reboot into recovery
Select install zip from card -> choose zip from sdcard
Select the installation of the new framework and confirm the installation
Reboot
If you are stuck in an infinite boot-up cycle
Take the battery out
Using 3-key combination boot into recovery (up-down volume + power. Hold until the AT&T screen cycles back, then release)
Install your original framework backup and reboot
Creating clockwork installation
After you have finished modifying the files, the best way to get them to the phone is through clockwork installation. Make sure that you have the original update.zip file on the sdcard. If you have a rooted phone, you probably have that already, but if not you can install ROM manager from the market and run it to get the update in place.
To create the installation file follow these steps:
Create a folder \framework
Place your modified framework files in that folder
Back in the main folder, create the following folder tree: \META-INF\com\google\android
In the android folder create a text file named update-script
WARNING: Do not name your framework file "update.zip"! You need both the original update.zip and the framework one for the installation.
Note: Although copying of the framework files may be possible, it is highly risky. In my experience installation from clockwork is the easiest
Puzzle Lock Screen Mod
Here is information for people who want to modify the look of the puzzle lock screen. It is only the list of images to replace, not the coding to change functionality.
The files sit in framework-res.apk under res\drawable-hdpi. The files are zzz_unlock_puzzle...
puzzle pieces
zzz_unlock_puzzle_noti_icon_call.png : Missed call piece in the floating state
zzz_unlock_puzzle_noti_icon_call_fit.png : Missed call when it gets to the unlock spot
zzz_unlock_puzzle_noti_icon_unlock.png : General unlock floating
zzz_unlock_puzzle_noti_icon_unlock_fit.png : General unlock at the unlock spot
Same for messages and voicemail.
Background
zzz_unlock_puzzle_bg.png : The image that shows on the lock screen. This should be semi-transparent if you want to show the regular screen background
zzz_unlock_puzzle_bg_pressed.png : Image that shows while dragging the puzzle pieces. Usually a slight modification of the regular background
zzz_unlock_puzzle_bg_land.png : The landscape version
Music player
zzz_unlock_disk... and zzz_unlock_ctr_pr... are the files related to the player.
zzz_unlock_ctr_bg.9.png is the background for the music controls
Text background
Overlaying the unlock image is text. That text can have background that is more opaque than the rest of the unlock screen.
The attached image shows the three regions. These regions also apply to the glass unlock.
Note: These are .9 files and should be done right to ensure correct stretching and text boundries.
Other files
There are some extra background files in the frameworks but I haven't been able to find where they go. There are also some files to control the clock numbers zzz_unlock_clock_...
Working with APK manager
What is APK manager?
APK manager is a tool for decompiling / recompiling apk files. If you want to change anything other than images, it is a must have.
The basics
The basic flow when using APK manager is
Place apk file in place-apk-here-for-modding folder
run the Script.bat file
Type 22 and select the file you want to work with
Type 9 and wait for it to finish decompiling
Modify the items you want modified (they will be in the projects folder)
type 11 to recompile
Sounds easy? It is, and it isn't. There are several places where things can go wrong. Here are a few of the things to watch for:
Bad starting file
This is mostly true for framework files that went through several cycles of modifications. The framework is forgiving to having extra items, or having bad .9 images (see post above about .9 images). Some people may have replaced images without recompiling the framework in a way that breaks internal links. If this happens you will very likely see error messages during the decompile stage. If that happens check the log file and correct things. One of the most common errors is .9 files replaced with regular images. See this post for how to solve this.
Things may not always be "fixable", so the best approach is to get the original framework that is the base for the one you need. Having a clean start can save a lot of headaches later on.
Overwriting your changes
When you recompile, assuming everything worked ok, you are prompted if this is a system file. Most likely you want to say yes. This ensures that the original signature is copied over. You will also be prompted if you want to copy some files over from the original. BE CAREFUL!. There are people who say you reduce the risk of errors if you copy things that didn't change. Personally, if I changed anything that required recompilation (mostly added new images or modified xml files) I always choose not to copy extra files. If you do choose to copy some files over, pay attention to the next step. Do not hit any key until you remove the modified files. You will need to go to the newly created "keep" folder (in the top apk manager directory) and remove any image that you changed and any xml that you modified. Also, if you modified xml files to add new images you need to delete "resources.arsc".
Failed rebuild
APK manager is trying to minimize work by only compiling newly changed items. If you built an apk and realized you have an error, or want to add more changes, I recommend removing the cached build. Go to the projects folder and delete the "build" folder. I've had cases where the new items didn't catch.
Removed items
I highly recommend to leave icons that you do not need. I've had occasions where I removed things that I thought had no more reference, but then ended with endless boot-loops. For example, if you modify the xml to only show 6 out of the 101 battery charge animations, leave the remaining icons in your project.
If you're stuck
Look at the log file. That would usually give you an answer. Also, if you are working on a recent GB ROM you probably need to get the beta 5 version. Version 4.9 will have problems compiling the newer files.
Thanks for the info!!! I have been wanting to play with themes for a while. Now I gots the knowledge.
sent from my Cap using the app.
Thanks for this post...I'll be looking into this for sure.
tsachi said:
After you have finished modifying the files, the best way to get them to the phone is through clockwork installation. Make sure that you have the original update.zip file on the sdcard. If you have a rooted phone, you probably have that already, but if not you can install ROM manager from the market and run it to get the update in place.
To create the installation file follow these steps:
Create a folder \framework
Place your modified framework files in that folder
Back in the main folder, create the following folder tree: \META-INF\com\google\android
In the android folder create a text file named update-script
WARNING: Do not name your framework file "update.zip"! You need both the original update.zip and the framework one for the installation.
Note: Although copying of the framework files may be possible, it is highly risky. In my experience installation from clockwork is the easiest
Click to expand...
Click to collapse
Thanks for this.. Question In #4 above the text file in the android folder. Is that an empty file? no extension? Thanks for your help.
TorqueWrench001 said:
Thanks for this.. Question In #4 above the text file in the android folder. Is that an empty file? no extension? Thanks for your help.
Click to expand...
Click to collapse
The file has no extension but it isn't empty. It contains the installation instructions. Typical instructions would be:
copy_dir PACKAGE:framework SYSTEM:framework
which copies everything in the frameworks folder in the zip file to the system/framework folder on the phone
Sent from a captivate running phoenix using XDA app
https://docs.google.com/Doc?docid=0AcdxIJRSH9ypZGZzc2pxNDlfMjdnazk4OHNxZA&hl=en
http://forum.xda-developers.com/showthread.php?t=916814
Good info
Thanks, been wanting to play with themes for a while now!!!!!
This needs a bump for all those requesting themes to be made.
This needs to be a sticky. I detailed guide is just what was needed. I been wanting to play around with themes but always end up doing something stupid so it never works. Now I have some more knowledge and hopefully can avoid that mistake.
Thank you, one of the links has the info I need to fix my text color issue in my notification/menu window!
Sent from a phone using an app.
Why it's not pinned it's beyond me. We have a thread pinned for must have apps that aren't even must have apps, but not this.
That was do to some how me missing this thread for the post few months. It is corrected now. Stuck
Since the thread is getting more life, I just added info on lock screen (fourth post)
Sent from my captivate running the latest firefly
Resorce dump
Well now that this is not going to fall to the depths of page 500, ill unload some rubbish into it.
http://android.modaco.com/content/zte-blade-themes-and-design-customisation/328510/guide-theme-editing-and-related-things/
http://forum.xda-developers.com/showpost.php?p=9066440&postcount=1
http://forum.xda-developers.com/showthread.php?t=593932
http://forum.xda-developers.com/showthread.php?t=695701
http://forum.xda-developers.com/showpost.php?p=8105110&postcount=2
http://developerlife.com/tutorials/?p=309
http://www.droidforums.net/forum/team-inversion-conversion/116419-so-you-want-edit-xmls-more-adb-apk-manager-how-basics.html
http://www.colorschemer.com/online.html
http://www.colorsontheweb.com/colorwizard.asp
Edit: I purposefully did not include descriptions in the links. If you dont know what your doing reading all but the last two links in there entirety will help get you on your way.
whiteguypl said:
Well now that this is not going to fall to the depths of page 500, ill unload some rubbish into it.
http://android.modaco.com/content/zte-blade-themes-and-design-customisation/328510/guide-theme-editing-and-related-things/
http://forum.xda-developers.com/showpost.php?p=9066440&postcount=1
http://forum.xda-developers.com/showthread.php?t=593932
http://forum.xda-developers.com/showthread.php?t=695701
http://forum.xda-developers.com/showpost.php?p=8105110&postcount=2
http://developerlife.com/tutorials/?p=309
http://www.droidforums.net/forum/team-inversion-conversion/116419-so-you-want-edit-xmls-more-adb-apk-manager-how-basics.html
http://www.colorschemer.com/online.html
http://www.colorsontheweb.com/colorwizard.asp
Edit: I purposefully did not include descriptions in the links. If you dont know what your doing reading all but the last two links in there entirety will help get you on your way.
Click to expand...
Click to collapse
Very nice, I will add these to OP with details about each link.
I'm quite happy that this has been pinned finally. Now to get to work. I haven't decided on which ROM I want to do, or even if I wanna port another theme or make my own. SO MANY CHOICES!!
ok... status_bar_close_on_cust.9.png
i believe i have followed all the guides i have seen correctly. sorry. i've been stuck on this for almost 4 hours.
i opened the apk in 7zip, exported the image.
removed the 9 from the file name
edited the png in PS
opened draw9patch,
added the full bottom and right side lines.
added the 2 dots i need on top and made the leftside work after eclipse failure
did the eclipse project thing
pulled new status_bar_close_on_cust.9.png from the eclipse created apk
opened framework-res.apk in 7zip again
i tried both..
- deleting the original image and then adding the new to the archive
- drag-drop the new image thus replacing the original
resign the rom's zip
when i install on system i get the bootloop with each loop getting shorter.
i have tried converting framework-res.apk to a zip, resigning it, and then back to an apk
i know this is a much descussed subject on this forum and all the other's i googled looking for the missing step or something i'm doing wrong
i have tried apkmanager, apktools, shorter suggested methods i've seen, and full drawn out methods.
i dont know if i'm messing something up in the png edit, the draw9patch, eclipse, signing or not the apk, or somewhere else.
i've tried pulling a logcat/boot.log from the device but i get some sort of error. i dont know if it's not creating one or i'm trying to pull it from the wrong place.
i'm sure a ton of you guys have had this happen to you. please offer some advice
Do you get an error when importing into eclipse? If so what does it say?
im sorry shoulda clarified that. originally i failed to put the patches on the left side. it failed when trying to make the apk. put thos there and the apk was created. my proplem is with the framework-res.apk i guess.
i put it back in the rom, sign it, and boot-loops.
i guess it has something to do with adding the image to the framework-res.apk. apparently it doesnt like the new image, so to speak. i have tried finding out how to re-build the framework-res.apk, to no avail. hell, i may be using the wrong terminology when searching. at this point, i have no idea.
If i change any images i use metamorph, free from the market. You dont need to sign and flash full apk's, just the files that need changing, a lot quicker and easier.
You could create your ***.9.png as a full size png and remove the 9 patch data, eg. instead of having a 5x32.9png make it 320x32.png(depending on your resolution).
In fact come to think of it ive never seen the "status_bar_close_on_cust.9.png" on my screen, just "status_bar_close_on.9.png".
EDIT: If you've used apktool or other to decompile, crop the the edges by 1 pixel each side, this will remove the 9 patch data, edit your image, then use your draw9 tool, and recompile with eclipse.
You may have been adding another 1 pixel 9patch border to the already existing 9patch border, hope that makes sense.
this is the custom pull down notification bar in gingerfly-1.7.0 based on cm6.1 i believe with some gingerbread looks.
This is how I do it:
1. Extract image from framework-res.akp. You can right click on the framework > 7-zip > open archive and extract the image this way or just extract the whole apk.
2. Edit the image. Open the image in Photoshop and do what you want. Don't worry if you don't have the border. Save the image as a .png file.
3.Add the border. Open draw9patch and add the image. A border for the dots should be created automatically so just do what you need to do and save it as the same file name. It should automatically change the file type to .9.png.
4. Compile the image.9.png. Download the file attached. In the zip, you should see a file called 'xUltimate-d9pc' and a folder called 'Original'. Put the image into the folder 'drawable inside 'res' inside 'Original'. Then open the file named 'xUltimate-d9pc' and wait. When it has finished, there should be a new folder and inside should be the compiled image.
5. Replace the image in framework. Right click framework-res.apk > 7-zip > open archive. Drag the new image into the framework, make sure you have the same file name. You shouldn't need to sign it.
Now you should have a framework-res.apk working with no problem.
I'm not sure if it will work for a custom rom as I use the framework-res.apk from my X10
Hope this helps.
that worked! thanks much!!! the one step i did add to this is to re-sign the rom. i have had nothing but problems anytime i have not signed it after making any changes. it may be an un-needed step, but it worked. thanks again!!!
Can I bump this real quick?
This is my first post here and I'm sorry if I shouldn't bump this thread but my problem is closely related and I hope someone out there knows what I'm doing wrong.
First things first, I'm using the EVO, that's probably important information.
I just flashed Warm Z TwoPointTwo and I love it, except... I really want the vanilla lockscreen. No problem, right? Just rename or delete HtcLockScreen.apk and you're good to go.
That works, and the vanilla lock screen appears upon hot reboot, but the images aren't right; they are all transparent in Warm Z. I have been trying basically all day to get the stock images back into framework-res.apk and nothing has worked; I bootloop every time.
The images are jog_tab_* except that the images in MY framework-res.apk have for example jog_tab_bar_left_end_confirm_gray.png (for all of the left and right end confirm images), whereas the AOSP framework-res.apk has 9patches for all of those.
I've tried deleting the jog_tab_* images in mine and placing in the ones from AOSP, I've tried placing the AOSP images in alongside the ones already in my copy, but nothing works.
I've tried apktool, apk manager, xultimate... I've read about 25 xda threads on this and tried every new suggestion. It bootloops no matter what I do. I think I'm missing something.
I've done the 7zip replacement without re-signing, I've re-signed, I've done xultimate with compression 0, and I've tried creating my own metamorphs. Something about Warm Z is conflicting with the vanilla images, but I'm too inexperienced in themes and the Android OS to know what's up.
Perhaps Warm Z changes definitions elsewhere as to which images are used, or perhaps something else isn't lining up properly with the vanilla lockscreen code. I hope someone out there knows what on earth I'm talking about.