I was looking to theming some of my apps & thought I'd start out simple. So I decomipiled my LGDownloadsUi.apk (pull from decompiled system.img) & copied the necessary framework files, installed them, and decompiled.
I looked in the res/values directory found the colors xml & changed the text color hex code.
Upon recompiling the values folder is not in the new apk. (Since it's a system app I need to copy the new xml from the newly compiled apk to the original to maintain the sig.) I tried simply deleting everything except for meta folder & moving everything over, but that result s in getting stuck in tmo splash screen. Am I missing something? Is editing the values xml files only viable in non system apk's? Do they get compiled into another file perhaps?
My device is a LG G3 D851 running MM 6.0
For decompiling I'm using the latest version of apktool.
Also I created a custom zip containing app & priv-app no framework, as my phone already has the framework files. Do I need to flash the same framework files from the decompiled system.img as well over my current ones? Thanks for any help.
TheLogicalGamer said:
I was looking to theming some of my apps & thought I'd start out simple. So I decomipiled my LGDownloadsUi.apk (pull from decompiled system.img) & copied the necessary framework files, installed them, and decompiled.
I looked in the res/values directory found the colors xml & changed the text color hex code.
Upon recompiling the values folder is not in the new apk. (Since it's a system app I need to copy the new xml from the newly compiled apk to the original to maintain the sig.) I tried simply deleting everything except for meta folder & moving everything over, but that result s in getting stuck in tmo splash screen. Am I missing something? Is editing the values xml files only viable in non system apk's? Do they get compiled into another file perhaps?
My device is a LG G3 D851 running MM 6.0
For decompiling I'm using the latest version of apktool.
Also I created a custom zip containing app & priv-app no framework, as my phone already has the framework files. Do I need to flash the same framework files from the decompiled system.img as well over my current ones? Thanks for any help.
Click to expand...
Click to collapse
I discovered that you can edit those xml's build the apk, the copy android manifest.xml and meta folder into the build folder. Then rebuild the apk to avoid signature issues. Instead coping the edit xml's into the new apk.
Related
Hi all,
I tried to theme an apk (ie. SwitchPro), after some search I got ApkTool and Android-sign (osx droplet).
So to test if it worked I decompressed it using ApkTool and recompressed, then Signed.
During apk install it just says "App not installed".
What's wrong ?
Thanks
The problem i had was that the resulting .apk seemed a lot smaller than it should after recompileing with apktool. If you are just editing images i suggest extracting the images form the .apk. Then you edit as you like. Then open the original apk with WinRAR (or whatever you use) and simply add your edited images to the .apk file. Then install and it should work.
Noob to theme'ing.
Do I have to make an update zip to theme or can I modify the framework apk and just push that to /system/app?
You can just modify and push framework-res.apk to system/framework/
Sent from my ADR6300 using XDA App
Oddity said:
You can just modify and push framework-res.apk to system/framework/
Click to expand...
Click to collapse
system/framework/
sorry i've been at this computer too long lol
My replacement keeps giving me boot loops.
All I changed was: I duplicated the green lockslider and its components and renamed them to replace the other gray locksliders.
then I compressed the framework-res to a zip (using built in mac zip compression, mac user so i can't use winrar) and change zip to apk. adb push to system/framework/
any ideas what is going wrong?
cupcakera said:
My replacement keeps giving me boot loops.
All I changed was: I duplicated the green lockslider and its components and renamed them to replace the other gray locksliders.
then I compressed the framework-res to a zip (using built in mac zip compression, mac user so i can't use winrar) and change zip to apk. adb push to system/framework/
any ideas what is going wrong?
Click to expand...
Click to collapse
Have you tried installing it via a update.zip?
cupcakera said:
My replacement keeps giving me boot loops.
All I changed was: I duplicated the green lockslider and its components and renamed them to replace the other gray locksliders.
then I compressed the framework-res to a zip (using built in mac zip compression, mac user so i can't use winrar) and change zip to apk. adb push to system/framework/
any ideas what is going wrong?
Click to expand...
Click to collapse
Well this gets to be a bit confusing. I will say what i know hopefully others can help out too.
APKs are just zip containers that are signed, that means there is no compression. In your zip program look for a setting under compression labeled store. You would then have to sign that bad boy in order for your phone to work. You can not use the testsign certificate.
With that being said here is a guide...
Modifying?
PNG's -> open the apk up in the zip program, navigate to the res/whatever_folder_had_the_original and drop your files in.
9.PNGs and XML more complicated. You will have to decompile the apk [apktool] then modify them [look for articles on that, i cant get too indepth here]. Compile the apk. Drag the now compiled xml and 9.pngs to the respective folder open in your zip program.
Really the object is not to mess up the signing that comes with the apk. opening up the apk in a zip program, allows you to view, and replace files with not destroying the signature.
This method will not work with all applications. I have still not figured why some programs work with being signed with a testcert and others are not. I have a hunch that all userspace programs can be test signed and all system files need their own [htc?] key.
Also to note is that for some reason the phone when looking at framework-res, services.jar and others does not seem to mind the differences in CRC of the files stored in it, with what is in the manifest. I still can figure out the phones reasoning to allow this to happen on some but not all apps.
I hope this was not very confusing. I am working on video toturials of this same subject. Stay tuned!
That really helps a lot. Thanks.
I'll try that out tonight. Any recommendations for zip programs with a store feature for mac?
cupcakera said:
That really helps a lot. Thanks.
I'll try that out tonight. Any recommendations for zip programs with a store feature for mac?
Click to expand...
Click to collapse
I use BetterZip on my mac..........open the apk with Betterzip, then extract the res folder to your desktop (or wherever you want). Edit the .png files you want.......steer clear ( unless you know how) of editing the 9.png files. Delete the original res folder from the framework folder and insert the res folder you just edited. Then save the framework-res.apk and push back to where it belongs.
I like 7zip better, but this works okay, since there is no 7zip for a mac.
Betterzip worked perfectly! Thanks again.
Hi there,
I am trying to learn all this theming and have started with the basics, the notification bar icons in framework-res.apk.
I can pull it from the phone, I can decompile it but I am having a challenge putting it all back together as I changed the number of images in a specific animation and then edited the XML file regarding that, but I think there must be other references to the files as now there are less files and the error log is saying it can't find the ones I removed (both the png's and the references in the one xml file) when trying to recompile.
Is there a master XML listing all the files expected or something.
many thanks in advance
David P
Let me guess you are using apktool?
What you need to do is take a clean version of the apk you want to edit. For arguments sake let's say you are editing framework-res.apk.
Decompile using apktool and make your edits to .xml files ONLY. Once done recompile using,
apktool b -f [foldername] framework-res.apk
Now this recompiled apk will probably not work. However the xml files will be properly recompiled. So now you extract the edited .xml files, add them to a clean unedited framework-res.apk (not a de and re copmpiled one) without extracting the .apk. Just add and replace the files using WinRar or whatever.
Also add your edited images to necessary folder in the clean .apk too. So the end result is a clean framework-res.apk that you have updated with your edited .xml files and edited images. This apk should function just fine!!
Sorry if this is a big mess but it makes sense to me and it works for me.
Thanks for the suggestion. I am not quite sure what I am using, I have tried ThemePro for windows and APKManager, both of which are just scripted batch files so I would need to check what they use to extract or decompile with.
So Basically, I decompile, edit the xml (while textual) then recompile so the XML's are binary again. Then pull the BINARY XML#'s from the APK and use those with all the appropriate files and folders which I then create a new clean APK from by zipping it and renaming to .apk, correct?
David P
ephumuris said:
Let me guess you are using apktool?
What you need to do is take a clean version of the apk you want to edit. For arguments sake let's say you are editing framework-res.apk.
Decompile using apktool and make your edits to .xml files ONLY. Once done recompile using,
apktool b -f [foldername] framework-res.apk
Now this recompiled apk will probably not work. However the xml files will be properly recompiled. So now you extract the edited .xml files, add them to a clean unedited framework-res.apk (not a de and re copmpiled one) without extracting the .apk. Just add and replace the files using WinRar or whatever.
Also add your edited images to necessary folder in the clean .apk too. So the end result is a clean framework-res.apk that you have updated with your edited .xml files and edited images. This apk should function just fine!!
Sorry if this is a big mess but it makes sense to me and it works for me.
Click to expand...
Click to collapse
A lot of thanks!!! I'm looking for an explanation like this, all that I try give me an unusable framework-res.apk and now I know why.
ephumuris said:
Now this recompiled apk will probably not work.
Click to expand...
Click to collapse
Apktool creates "clean" apks as you name them. There is almost no difference between application built from sources or using apktool. And almost no logical difference between original apk and rebuilt one (for most apps, of course apktool doesn't support some of them).
If you are talking about system apps, then your problems are most probably related to incorrect way of installing resulting apk, not to it's structure. You can't reinstall system app easily and one of workarounds is to copy AndroidManifest.xml and META-INF from original file and push it to a device. Actually you did this using your method and I think this is the reason, why you think there is something wrong with apks built by apktool.
Hi,
I'm trying to make some changes to framework-res.apk.
I user APK Manager 4.9 to decompile the file, then made one trivial change to a XML file (changed one auto brightness related value).
I then compiled back to APK without signing and pushed to the phone in recovery mode the deleted Dalvik cache just to be on the safe side.
No matter how I play with it I always get FC from all the system apps immediately after the phone completes the boot process.
Some more information:
1. My original APK had directories like /res/drawable-hdpi-v4 while after decomplie they become res/drawable-hdpi (without the "v4")
2. After I recompile the "v4" directories are not created back and the generated APK contains the directories without the v4
3. If I use the "Reduce errors" feature of the APK manager complie option then I end up with APK that contains both the directories with v4 and those without.
4. I tried with the "reduce errors" option and without it (in which case I manually copied the signature directory into the APK) but got same FC.
5. It seems that once the FCs begin to happen they don't stop until a full nandroid restore. Even if I put the original framework.res.apk file I still get FCs after rebooting.
6. I'm using Revolution HD 2.0.11 ROM
7. The APK file I'm trying to modify was generated by the UOT kitchen.
Any idea what am I doing wrong?
No one knows?
erank said:
No one knows?
Click to expand...
Click to collapse
You dont need to decompile the framework to edit the files, heres the best way, take the the original framework-res.apk, and copy it to your pc, use 7zip to extract the .apk and extract any files you want to edit from the extracted framework, now go back to your original framework-res.apk and right click on it, find 7zip in the contex menu and click open, the contents of the apk will appear in a new window, now just drag and drop your edied files in the right directorys, once done, close 7zip, push the framework back to /system/framework/, wipe the dalvik cache and your done
AndroHero said:
You dont need to decompile the framework to edit the files, heres the best way, take the the original framework-res.apk, and copy it to your pc, use 7zip to extract the .apk and extract any files you want to edit from the extracted framework, now go back to your original framework-res.apk and right click on it, find 7zip in the contex menu and click open, the contents of the apk will appear in a new window, now just drag and drop your edied files in the right directorys, once done, close 7zip, push the framework back to /system/framework/, wipe the dalvik cache and your done
Click to expand...
Click to collapse
The files I want to edit are XML files which are compiled to reasources.arsc, as far as I know 7zip can't extract those, it has to be decompiled.
erank said:
The files I want to edit are XML files which are compiled to reasources.arsc, as far as I know 7zip can't extract those, it has to be decompiled.
Click to expand...
Click to collapse
Too true, the only other thing you could try is to sign the .apk before pushing it....
Sent from my Desire HD using Tapatalk
AndroHero said:
Too true, the only other thing you could try is to sign the .apk before pushing it....
Click to expand...
Click to collapse
Thanks AndroHero.
Everywhere I was looking they always say not to sign system APKs, but just to be sure I also tried signing it and not signing but copying the original META-INF directory - always got the same result - FC in all systems apps after boot.
The lazy man’s guide to theming.
I get requests all the time to make simple changes to my themes that anyone with a computer can do. So I put together this quick guide on how to theme the easy way. This is how I do most of my themes minus any xml edits or battery mods. This guide is for changing images only without having to decompile and recompile the entire apk file with apktool or apk manager. Great for when you just want to make a few changes to your existing setup.
What you will need.
~ 7zip use Google search it’s easy to find
~ image editor Gimp is great and free you can Google it also. I use Fireworks and Photoshop depending on what I am trying to do.
~ Draw9Suite. Created by tommytomatoe/kakomalo Thread found here http://forum.xda-developers.com/showthread.php?t=1272513
Download here: http://www.4shared.com/zip/TaDGMjde/9patchPngSuite.html
Unzip and place contents in folder, I have mine on my desktop.
~ An existing rom or theme to modify.
With just these tools you can do a lot.
Once you have 7zip and 9patchPngSuite on your system you will need to download the rom, or already existing theme for the rom you are on so you can make the changes you want to it.
Download the rom/theme you want to make changes to and use 7zip to unpack the rom/theme you downloaded, do this by right clicking on the zip file and chose open with 7zip. Inside you will find lots of folders, the ones you are looking for will be in system/app (for apps) or system/framework (for framework files). Extract the apk’s by just dragging them out of the 7zip window, to a folder on your desktop.
Inside the folder you extracted the apk’s to create a folder for each apk’s you extracted. Now you will want to extract the folder drawable-hdpi from the res folder of each apk to its associated folder, do this with 7zip also the same way you extracted the apk file. Once the drawable-hdpi folders are extracted you will see the images inside that you can modify.
At this point I create another folder inside each of the specific apk folders and name it .9 images and I copy and paste all the .9 images I want to change into that folder (these are for reference). I then copy all of those images into the compiled folder of 9patchPngSuite. And chose option 1 to decompile them. Now look in the decompiled folder and you can now take those images and change anything inside the black lines and dots you will see on the outside edge. If you feel like it you can also create your own .9 file with your own image by choosing option 2, this will open up draw9patch. Maser&Slave made a great tutorial on this so I won’t go into it. Edit your images, but be careful if the image displays words on it (like with popup_center_dark.9 )and it has a dark background it should remain dark so the word will still be readable, and vice versa if the image has a light background it most likely will have a dark font displayed on it that will be difficult to read if you make the image a dark color. Once all your images are edited use option 3 to recompile them, now in the output folder you will find your recompiled images that you can put back into your drawable-hdpi folder. Edit any other images you want just be careful with the pixel size if an image is 70X70 and you make it 140X140 it could cause some problems, some you can change others you can’t, it’s a lot of trial and error. Once all edits are finished put them all back in the drawable-hdpi folder you extracted from the apk, use 7zip to open the apk again, navigate to the res folder and delete the existing drawable-hdpi folder and drop the one you made the changes to into it, use the back arrow in the 7zip window and it will zip it back up and you can push the apk or flash it to test if your images came out the way you wanted them to. This will work with any image you chose to edit. You can also use this method add images from other themes you like to modify your theme to the way you want it. Just copy and paste the images you want to change into the drawabel-hdpi folder of the theme you are creating.
Brief list of what each apk controls, I am still new to ICS so if anyone knows more info please post.
Framework-res.apk
This will contain most of the images you will want to make changes to. Including check boxes, popup windows, menus, tabs, general status bar images, some lockscreen clocks, and a lot more. You will recognize them as you scroll through them. Some are hard to recognize like activity_tite_bar.9 and dark_header.9 because they are small, it will take some practice and trial and error to get the look you want.
Twframework-res.apk
This contains very little in ICS it still controls the tab backgrounds for a lot of apps but that is all I have found so far.
Systemui.apk
This apk contains most of the files for your dropdown and status bar, like signal bars, 3g 4g icons, wifi strength icons ,dropdown background and more. in ICS it also contains the battery images.
Ik95-res.apk and lidroid-res.apk
These apks contain the toggle images and background In the dropdown i.e. wifi toggle, airplane mode toggle etc. for the 14 ad 15 toggle mods.
Here is a standard flashable zip file you can put your modified apk files in and flash with CWM, open with 7zip and put your apk file in the corresponding folder in the flashable zip if you pulled it from framework put it back in the system/framework folder, if you pulled it from app put it in system/app folder in the flashable zip. Then flash like any other theme.
Flashable zip : http://www.4shared.com/zip/cmn3J1yd/My_flash.html
included below is a word doc of this tutorial.
future additions ....
Thanks for the guide, chief!