In the course of testing my first theme I decided to try something as a sanity check. I took a working theme (Templatebread) decompiled, recompiled, and signed it, then tried to apply the theme. It fails with the error "This theme was improperly compiled and cannot be applied."
I'm using Templatebread referenced here [http://forum.xda-developers.com/showthread.php?t=964391] and performed the following:
1. install Templatebread as is, apply the theme, no issues. This is to validate that the package I'm using actually works on my phone.
2. Uninstall Templatebread
3. Include the framework-res.apk from my phone [apktool if framework-res.apk]
3. Decompile Templatebread using apktool [apktool d Templatebread-signed.apk]
4. Recompile Templatebread using apktool [apktool b Templatebread-signed.apk]
5. Sign Templatebread using apk manager [place it in the "place-apk-here-for-signing" folder and use option 16]
6. Copy the recompiled and signed apk to my phone via USB
7. Install apk as normal
8. Attempt to apply the theme through Theme Chooser and it fails.
Anybody have any idea what I'm missing here? Why would the theme work normally, but fail when I try to decompile and recompile it without making any changes?
Here's some things you should know. When working on templatebread on windows you can only make a theme for hdpi and mdpi separate. There are no all in ones. (only in linux) So therefore:
HDPI device theme
-preview and icon go in 'drawable folder only'
MDPI device theme
-preview and icon go in the 'drawable hdpi' folder only
(Mdpi = 320x480 size HDPi = 480x800 size)
Thanks! This works on CM9 themes as well. If you place the images in drawable-nodpi, it works on xhdpi, hdpi. I haven't tested mdpi yet.
Related
Well Im not great at directions so this is the best i can do.
Summary
There are 2 ways that I know to port a theme to your device.
1. Using the metamorph app if its a metamorph theme.
2. Using 7zip ect.. if its a flashable theme. (most common)
Metamorph Instructions
1. First things first is to download the theme that you want to port.
2. Your theme will be a zip file containing only image files from apk's
3. Put the zip file on your sd card
4. Make sure your device is set to 320x480 resolution or metamorph app will not work.
5. Open metamorph app and start a new project.
6. Locate your zip file and let all the apks load up.
7. Install each apk one at a time. Do not install any jar files as they will cause your phone not to boot.
8. Reboot and your Theme should be working on your phone.
Flashable Theme Porting Instructions
Its not that difficult, once you get the hang of how 7zip works it will be your best freind. Its just a process of dragging and dropping images from one apk to another all within 7zip.
What the metamorph app does is takes themed images and places them into the correct apks res\drawable folders in your system.
Knowing what metamorph does as an app, you can do this manually using 7zip.
1. Download the theme that you want to port. It will be a system folder with an app,framework, and font folder inside of it.
2. Open up that system folder with 7zip
3. Make a copy of the system folder of your current rom and open up that system with 7zip as well. You should now have 2 different 7zips open. Make sure to keep track of witch is witch.
4. Open up the app folder of the themed system and open up the first apk thats in there.
5. Go into the res\drawable folder in the apk in both your system and the themed system.
6. highlight and drag and drop only the images from that folder to the same folder in the other base apk. Make sure to NOT highlight any xmls.
7. Do the same for any images in any other drawable folders the are mdpi.
8. If there are only hdpi folders and no mdpi folders than you will have to convert those images to mdpi size before using them. If there are both, than only use the mdpi images.
9. When finished overwriting those images in that first apk, go back to the other apks in the app folder and do the same thing. You can do all of this from with in 7zip. No need to exit 7zip in this entire process.
10. Open up the themed framework folder and you will see a framework-res.apk file. Open up that file, you will see the same res\drawable folders.
11. Also open up the framework-res.apk from the base theme in the other 7zip as well. And overwrite the images just like the other apks making sure not to overwrite any xmls.
12. Back out of that back into the framework folder itself, if there is a services.jar in the theme than you will want to use overwrite that file as well.
13. Back out of the framework folder, If there is a fonts folder in the theme, You will want to overwrite those files as well.
14. Now you are done modifying your base theme with all the images from the theme.
15. You can now close the themed 7zip that you downloaded and leave open the 7zip containing you newly modified apks. Create a folder on your desktop called "system". Inside that, create a folder called "app", "framework", and "fonts"
16. Move only the modified apks that you replaced images in into the correct folders in your new system folder.
17. Make an androidupdate.tar with 7zip out of your new system folder and you are ready to flash it using nomorootfs method.
Tips:
Using the shift button to highlight mutiple images saves time.
Using the ctrl button to highlight images with xmls between them aaves time.
Switching views to have all images at the top and xmls at the bottom saves time.
If i forgot steps, I appologize.
Excellent guide.
The only thing I would mention is that most of the time services.jar is specific to a particular rom and as such may not work correctly with the target rom. As services.jar really only contains themed elements for the titlebar, you are better off using colorChanger's, apkTool or a hex editior to manually change the titlebar colors.
Also, in some cases (Like ProLauncher) the apk's must be signed. I prefer to use the test keys and this handy context menu here.
simple direct and effective. thanks again for all you do sir.
myn said:
Excellent guide.
The only thing I would mention is that most of the time services.jar is specific to a particular rom and as such may not work correctly with the target rom. As services.jar really only contains themed elements for the titlebar, you are better off using colorChanger's, apkTool or a hex editior to manually change the titlebar colors.
Also, in some cases (Like ProLauncher) the apk's must be signed. I prefer to use the test keys and this handy context menu here.
Click to expand...
Click to collapse
Thanks for the info man.
BTW, HAPPY BIRTHDAY MYN
Dzo Odex sample with standard theme
Thanks for this info. This will help a million. Could you also put light on how to odex it?
Eg: Dzo's odexed sample of donut has plastic theme, can it be changed to a standard android theme using the steps above and then odex it to create a androidinstall.tar?
Nice guide.
Thanks for making this.
Ill probably start trying to theme when i finish school in 2 weeks or so.
how to convert hdpi to mdpi
Hey everyone. i was wondering if you could help me with an annoying error i cannot fix.
so i have my theme (based off Templatebread -- its my first theme) that i compiled using apktool and signed using Stericson's autosign.bat. Both were without errors.
I move to SD card via USB Storage mode and install using ASTRO. That goes fine. I open it up in Theme Chooser and get "This theme was improperly compiled and cannot be applied. Please report this incident to the theme author" when i click apply. the preview shows up fine.
I did a quick google search but all i got was that i might have put preview.png into drawable-hdpi insted of drawable. i checked it and moved it. didnt fix it.
Ive attached my source(yes, decompiled-modded is what i called the file my source is located in.... ) in a 7-zip file. if anyone could explain how to fix this that would be great!
Thanks!
Remove the \ in your AndroidManifest.xml like so
Code:
<theme pluto:themeId="DeepRed" pluto:styleId="@style/DeepRed" pluto:name="@string/theme_name" pluto:preview="@drawable/preview" pluto:author="@string/author" pluto:styleName="@string/style_appearance_name" />
It installs fine afterwards and you get the preview image in the theme chooser, compiled and tested myself.
Ok, I have the same problem, however, for some people it works fine, and others download and install have the problem.
not sure why for some it works, and other get the error
any ideas ?
thanks
There a preview in drawable-hdpi, delete it. it will work then
preview is in drawable folder, not drawable_hdpi
This is device specific, for some devices it works for some don't. If you are compiling on windows best option is to compile without preview, to ensure that it works on every device. There is no other solution.
Or you can compile on linux, that it will work.
If MDPI device - Put preview and icon in Drawable-hdpi folder.
If HDPI device - Put preview and icon in Drawable folder.
Remember you need a 'smali' folder for everything to be working fine. Remember to remove the '\'
Im having the same problem.
I am on linux too. I downloaded a theme that works on my phone and decompiled it, then recompiled it without changing anything, and resigned it and still it says it was improperly compiled. Any ideas?
zexcrazy said:
This is device specific, for some devices it works for some don't. If you are compiling on windows best option is to compile without preview, to ensure that it works on every device. There is no other solution.
Or you can compile on linux, that it will work.
Click to expand...
Click to collapse
compile it in linux with preview in the drawable folder? I've tried it both in the drawable and in the drawable-hdpi and it didnt work for a mdpi device i was testing it on
I removed the preview.png from both places and it worked!
HDPI theme.
Thanks!!!
I've had this issue before.
If I don't have the \, I get this error, and the preview is visible.
If I do have the \, the preview is not visible but the theme may be applied.
However, when I have the \, it may not work on my device, but it has for others...
I will remove the preview from drawable hdpi
how can we put the preview with out this error ?
a simple question if i want to change some png in framework-res.apk i have to put them in drawable-ldpi or drawable mdpi?
also there is a way to mix a theme from theme selector and png i insert in framework-res.apk?
Can.
I only recently downloaded ninjamorph but have not tried it yet...but it's known to cause some issues if u don't use it correctly. But it is simple.
Zipthemer is also a similar and widely used tool.
Better use a PC to do it if u have access to it.
yep i'm using pc to change icons but ninjamorph for repaking the apk when finished, as far as i tried even if there are ldpi and mdpi changes only takes effect if png is modified in ldpi, and just a few works... i really have no idea why even if i overwrite them somee are still there as i never modified them
Yes our roms are a lil weird, it chooses some icons form drawable ldpi and some from mdpi. But any changes in the png always did stick for me. Are u on a theme or just on default system theme?
But use PC for the entire process and check, just open the framework apk in a zip archive, drag and drop the new png in the appropriate folder, if It is ur framework apk then no need to sign it. Just don't extract it.
Btw replace icons in both ldpi and mdpi, unless u know which icon is being used. Which icons are u trying to replace?
i can directly mount /system from recovery or do i need to use adb method? i just tried some random icons, the goal is to change lockscreen circle icons (cm7) and in-call stuff
Well yes u need adb to access anything from recovery. But u can also replace framework using root explorer, though not the best method but can be done. I've replaced lock icons..zdune's miui lock icons. U can also use a flashable zip if u know how to create one or if u find one. But root Explorer works.
Publishing the messaging app I modified for my taste. Maybe someone might like it.
Modifications include:
Enter key instead of Smiley
7 lines to enter message
No avatars in message list
Install instructions:
Backup current Mms.apk from /system/app
Replace Mms.apk with attached one and set permissions if you broke them
Reboot phone
Select black theme (white theme is unmodified)
Select not to send message on Enter click
Created with apktool by decompiling, recompiling and replacing the compiled xmls inside signed original Mms.apk. Attached the xmls if anyone might want to check the diffs or use for other version.
Apk taken from cm-7.2.0-ace so it will work on Desire HD running CyanogenMod 7.2. Other devices or ROMs might not work so don't complain. Will make the same modification for White theme if there will be request.
Enjoy
How To Theme TouchWiz Based ROM to look like AOSP!!
Ok guys I decided to share my theming method with you guys. This is mainly intended for all developers and or ROM developers!
If you have TouchWiz based ROM (Some devices below) you can theme it to have an AOSP feel to it.
Devices:
Galaxy SII
Galaxy SIII
Galaxy Note
Galaxy Note II (Tested by Me )
Some others as well...
Whats Needed:*APKTool DOWNLOAD HERE
*JAVA DOWNLAOD HERE
*7-ZIP DOWNLOAD HERE
*TouchWiz Base ROM
*SystemUI.apk (in system/app) **FROM TOUCHWIZ ROM**
*SystemUI.apk (in system/app) **FROM AOSP or CM10 ROM**
*Framework-res.apk and TWFramework-res.apk (in system/framework) **FROM TOUCHWIZ ROM**
*Zipalign tool
*Root Explorer App (Get from Google Play Store)
*Holo Launcher (Also get from Google Play Store)
Lets Get Started:Follow all of the steps below carefully and you should have an AOSP Themed TouchWiz ROM in no time
1. Download the Holo Launcher from the Google Play Store.
(When you run the launcher you will see that you will have an AOSP themed launcher and you will have AOSP system icons [messaging, phone, settings, ect..])
2. You need to install APKTool next. (If you already have this installed then skip this step)
*Download the APKtool files (link above)
*Put the files into your C drive. Make a folder in the root of your C drive called apktool.
*All of your files should go inside that folder (apktool)
*Go to CMD or Command Prompt and type in
Code:
cd C:\apktool
*That should redirect you to the apktool. If it worked then lets move on...
3. Get the framework-res.apk and TWFramework-res.apk (in system/framework) and place it in the apktool folder.
4. In the Command Prompt you will need to direct CMD to the APKtool folder. Then you must install the framework files by doing:
Code:
apktool if framework-res.apk
and
Code:
apktool if twframework-res.apk
Now your framework files are successfully installed. If you have an error in the CMD window then you must check your JAVA.
5. Now get your systemui.apk files from both AOSP (CM10) and TouchWiz ROM. Rename the AOSP systemui.apk to systemuiaosp.apk (so you dont get the touchwiz and aosp systemui's mixed up)
6. Make a backup of the TouchWiz systemui.apk in another folder called "Backup" ****YOU WILL NEED THIS LATER*****
7. Now you should have both systemuiaosp.apk and systemui.apk in the apktool folder. Now you must decompile both files by using these commands:
Code:
apktool d systemuiaosp.apk
and
Code:
aptkool d systemui.apk
You should have 2 more folders (systemuiaosp and systemui).
8. Here comes the actual theming of the systemui. Open both systemuiaosp and systemui folders side-by-side. And now you need to navigate to the drawable-xhdpi folder in both.
***FOLLOW THESE NEXT STEPS CAREFULLY OR YOU WILL HAVE AN ERROR***
9. Find the files you want to replace. They should all be PNG files. DO NOT JUST ADD PNG FILES FROM THE SYSTEMUIAOSP TO THE SYSTEMUI. YOU WILL GET ERRORS WHEN COMPILING THE FILE!! There are XML files (we will not edit in this tutorial) that use those PNG files with those extension names. So you can't just add files from one to another. For example:
If you have an icon you want to change but its only for that AOSP then it wont run on the TouchWiz. If you have a WiFi icon that has a name of AOSP_Wifi_1 and on the other systemui it says TOUCHWIZ_Wifi_1 you cant just delete the one that says TouchWIZ_WIFI_1 and replace it with the AOSP one. The XML files dont tell it to run the AOSP_WIFI_1. So you must ONLY REPLACE FILES WITH SAME EXTENSION NAME!!
10. You can go ahead and transfer files from the SystemuiAOSP to the systemui. Note what i said above!! If you have lets say 6 wifi icons for systemuiAOSP and 6 icons for systemui (touchwiz) you can rename the AOSP PNG files to match the TouchWiz ones so the XML files will know what to run.
I personally suggest only transferring Wifi Icons, Battery Icons, and Signal Icons. These are your most important ones to transfer! You can also transfer the Bluetooth and Airplane mode icons also.
11. After you have transfered the files over and you feel like you have done it correctly then you can go ahead and Compile the SystemUI folder by using this code:
Code:
apktool b systemui semidone.apk
12. If you did all the steps correctly above then apktool will build the apk file with no issues. If you have errors then you did not pay attention carefully. (You may want to try another CM10 ROM to get icons from).
13. Now here is where 7-Zip and your backup file comes into play. Open 7-Zip twice (2 windows). In the first window direct 7-zip to the semidone.apk file. And the second one to your backup file which should be SystemUI.apk (in the backup folder).
14. In the SystemUI.apk click on the RES folder and then find the Drawable-xhdpi folder. Delete the entire Drawable-xhdpi folder. Now in the other window (semidone.apk) go to RES and then transfer the entire Drawable-xhdpi folder into the SystemUI.apk window.
15. Now your SystemUI.apk in the Backup folder is your new modded one. But before you can use it you must zipalign it using any zipalign tools out there. I just use DSIxda's kitchen to do it since I make ROMs with it.
16. Now you can go ahead and transfer the SystemUI.apk onto your phone's SD card.
17. Download Root Explorer. Now go ahead and navigate to your SD card and click the SystemUI.apk file and then click copy or move. (whichever one you like).
18. Now navigate to your system/app folder and paste and overwrite the original one. (You will need to set root explorer to Read/Write). Now you can go ahead and reboot your device.
If you did everything correctly you should now have a themed launcher and a themed status bar with AOSP Icons!
I don't ask for donations so if this tutorial helped you then please hit that Thanks button!
MINE
Mine AGAIN
I was just looking for a thread like this... not sure if i have enough time and will to do it but i am very glad you post it!
thanks a lot!!!
ExcaliberX said:
I was just looking for a thread like this... not sure if i have enough time and will to do it but i am very glad you post it!
thanks a lot!!!
Click to expand...
Click to collapse
Your welcome. I hope it works for you!
So are there any screenshots showing exactly what changed? I'd like most of the UI to have an AOSP feel to it not just some parts. Does this theme all or just bits and pieces?
Shmi117 said:
So are there any screenshots showing exactly what changed? I'd like most of the UI to have an AOSP feel to it not just some parts. Does this theme all or just bits and pieces?
Click to expand...
Click to collapse
Well as said above it themes the launcher (holo) and the status bar icons are aosp.
thanks I was hoping to see where you find the blue background bars in the S2 in the settings menu SecSettings.apk or trframework or framework or systemUI I have looked everywhere and changed colors of .9pngs forever and it never phased them. obviously I never found the right one to change. would you happen to know and could you post here or pm me thanks. have a decent ROm that doesnt really need blue gray bars dominating the screen.