[Q][For Devs] png-out optimization on HTC_IME.apk [SOLVED] - EVO 4G Q&A, Help & Troubleshooting

I have a couple questions, really...
1) I ran pngout optimization on /system/app apks for a custom ROM that I have been working on and upon flashing HTC_IME does not work. I'm sure that this is because the .apk is unsigned, but I also know that it will fail if i resign with test keys. Question is: How do I disable signature verification in the ROM (as opposed to Recovery)?
2) Second question is along the same lines as the first. Are there any .apks that I should not optimize in any way?
Thanks!

grayn0de said:
I have a couple questions, really...
1) I ran pngout optimization on /system/app apks for a custom ROM that I have been working on and upon flashing HTC_IME does not work. I'm sure that this is because the .apk is unsigned, but I also know that it will fail if i resign with test keys. Question is: How do I disable signature verification in the ROM (as opposed to Recovery)?
2) Second question is along the same lines as the first. Are there any .apks that I should not optimize in any way?
Thanks!
Click to expand...
Click to collapse
Aye you need to make sure that you don't also have to make changes in framework. I'm right sure you need to and also Rosie. Think you can only disable it in recovery but I'm not sure.
Dicht yer neb and flee awea!

U can do one of two things...
1. U can sign with test keys and then resign the other apks with the sane test keys.
2. Make ur edits and then open up the original apk and replace the Res file with the one u edited.
Gotta make sure all the apks that u have in ur rom are all signed with the same keys or the apk that arnt will not work correctly.
Pretty much if ur just doing image edits then u can open the original and replace the Res folder but if doing if ur breaking it open with apk manager or something like that to edit XML or smali edits then u have to resign it and resign the rest of the apks as well...
Sent from my PC36100 using Tapatalk

Papa Smurf151 said:
U can do one of two things...
1. U can sign with test keys and then resign the other apks with the sane test keys.
2. Make ur edits and then open up the original apk and replace the Res file with the one u edited.
Gotta make sure all the apks that u have in ur rom are all signed with the same keys or the apk that arnt will not work correctly.
Pretty much if ur just doing image edits then u can open the original and replace the Res folder but if doing if ur breaking it open with apk manager or something like that to edit XML or smali edits then u have to resign it and resign the rest of the apks as well...
Sent from my PC36100 using Tapatalk
Click to expand...
Click to collapse
Perfecto. Thanks!

Related

[Q] Do I have to theme using an update zip?

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.

Problem with framework-res.apk

I can edit the framework-res.apk and it works but I'm wanting to edit it more and every time I push it my accounts get deleted (google, facebook,etc.) Is there any way to keep this from happening?
I don't believe so.
Sent from my SUPERSONIC
Ok well I know when I flash zips that edit the framework it doesn't effect my accounts so how would I be able make flashable zip files to edit the framework?
Swyped from my VaelPaked Evo 4G
You need a signing tool. Search for Ava's toolbox. Before signing, I believe, you need to delete the 3 cert files inside of the meta-inf folder. Then just place the framework file in the toolbox and sign it. Then it will be flashable.
Sent from my SUPERSONIC
dglowe343 said:
You need a signing tool. Search for Ava's toolbox. Before signing, I believe, you need to delete the 3 cert files inside of the meta-inf folder. Then just place the framework file in the toolbox and sign it. Then it will be flashable.
Sent from my SUPERSONIC
Click to expand...
Click to collapse
Yep, signing is really easy. Like dglowe said you do need to delete the 3 files in META-INF but you also need to open the update_script with notepad++ just to make sure it won't do something you don't want, like wiping /data or something. Most theme .zips should be fine to use as a template, just double check it before you sign and flash it.
Alright thx a ton! I'll c wut I can do with this whole signing business.
Swyped from my VaelPaked Evo 4G

[Q] question on editing framework-res.apk

hey guys.
i'm having a frustrating issue when editing framework-res.apk to include the rectangle battery mod.
this is a long post...please DO NOT POST GENERIC ANSWERS WITHOUT READING THE POST FIRST!!!
i'm used to editing framework-res.apk and all other .apks on my phone for various purposes. i use a combination of 7zip and apkmanager 4.9 to extract, replace, decompile/recompile, etc. depending on what i'm doing.
at this point here's what i'm trying to do:
DaGunn provided me with a modified framework-res.apk which includes a buttonized power control widget (from JsChiSurf's thread). this is v2.0 (on the 3.29 ota). previously i had v1.0 which I had fully customized to my liking.
the file provided to me by DaGunn has the buttonized look, and some smooth sense elements, as well as the super circle battery meter.
i opened framework-res.apk he provided with 7zip and replaced all the 901 images in res/drawable-hdpi with my own 901 image files from my existing framework. these files all have the same exact name and same exact extensions. (hence when I drag and drop into the new framework-res.apk in 7zip i get a direct replacement rather than having extra files).
this has worked countless times in the past. as a matter of fact, it worked 99% of the way this time. all the framework images went back to my customized images. except the battery disappeared.
i narrowed it down to the battery images. if i leave his 101 circle battery .pngs and replace every other file in framework-res, it works just fine. all my images show and the battery shows up in the circle style. if i then just replace his 101 circle battery .pngs with my 101 matted blues rectangle battery .pngs, which are the same exact names (i checked!) and extension, and after I optimized them almost exactly the same file size as well, everything goes to crap. the battery doesn't show up at all in the title bar.
if i plug in the phone, the rectangle charging animation works, the download animation works, all other smooth sense animations that I have replaced with the mattedblues files from my previous framework work. except for the battery.
now, if his .pngs work, and mine replace his directly with the same exact name and extension, why would the battery display suddenly disappear?!
I'm being told it has to do with resource IDs, but here's the problem. I was provided a "guide" on how to properly modify framework-res by one of the guys involved in MattedBlues (beatblaster). in it I was told that I only need to recompile framework-res after adding NEW .pngs, that if the .pngs were already accounted for in resources.arsc then trying to recompile would throw errors and instead I should replace those .pngs with 7zip. that's what i'm trying to do but as I said, then the battery meter doesn't work.
if i decompile DaGunn's original file, I'm able to recompile it just fine. keep in mind this file already has a lot of modifications on it as it is. but if i decompile his framework, and I replace his .pngs with mine, and try to recompile, I get thousands of lines of error in the log. all having to do with public.xml, which I'm being told goes back to resource IDs.
what am i missing here? i know how to remove the battery display from the title bar so I dont have that empty space, but I do enjoy my percentage battery and I would like to get this to work!
any input will be greatly appreciated...
+5 points for you if you read this far!
I'm not clear if you are recompiling or just dropping the images in, but if you are recompiling try making all your xml changes without adding the new images. Then after its compiled drop your new images in.
Sent from my PC36100 using XDA App
i'm not modifying any xmls. only replacing .pngs. it's specifically clarified in the OP.
the existing framework, with its modified .xmls and .pngs as given to me decompiles and recompiles just fine. if i decompile, then replace the .pngs with my own, and try to recompile, then it gives error. if i just open it in 7zip and replace the .pngs with my own, the battery disappears, but no force closes or error messages.
anyone else?
Are any of the .png files you are replacing have the 9.png extension? I know modifying these is very tedious and requires a more difficult process. Also can u post the errors in the apkmanager log?
Sent from my DROIDX using XDA App
nope. the files are stat_sys_battery_0 through stat_sys_battery_100. all .png not a single one in any other extension.
i can't post the apk manager log because it is literally thousands of lines of errors.
what I can do is give you the framework as I have it, working with his battery .pngs and a separate .zip with my battery .pngs, so you can try to do it yourself and see the problem/compile errors.
it really is weird...or stupidly simple!
Firstly you SHOULD NOT be decompiling just to swap images, even .9 pngs. You only need to decompile if you are editing xml files which by reading your post you aren't. To change pngs only, you should use option 1 (extract) in apk manager. Then change all your pngs you want changed. Use option 3 to recompress your framework. Make sure to tell it that it is a system apk, and then use option 12 to resign. You should be good to go.
t3project said:
Firstly you SHOULD NOT be decompiling just to swap images, even .9 pngs. You only need to decompile if you are editing xml files which by reading your post you aren't. To change pngs only, you should use option 1 (extract) in apk manager. Then change all your pngs you want changed. Use option 3 to recompress your framework. Make sure to tell it that it is a system apk, and then use option 12 to resign. You should be good to go.
Click to expand...
Click to collapse
+1
The reason I was confused about what you were trying to accomplish is because you don't need to decompile unless changing xml's.
Thats what I do for non system apps. I'll give it a try in the morning and see if it makes a difference.
Swyped from my HTC Evo 4G on the MetroPCS 1X network!
Ok first if you go to recompile something and you get errors usally the first error is the one causing the problem. Look and see what the first error is and fix it, like has been said what you are trying to do using 7 zip is a good way to do it, not decompiling. You said this is how you prefer way to do it anyway so that's good.
Second I have found at times that 7 zip does not properly replace threw images so weird things happen, only happens sometimes. With that said try using apk manager to unzip the apk replace the images and rezip it do not sign it. See if that works
Third. If all else fails download nijamorph from the market. Put the images you want on your scard where I can find them easy. Open nijamorph and start a new project navigate to your framework-res.apk.from here you can do two things first you can press existing project and find what you are looking for and change one at a time or the easy way. Close the app open your favorite file manager find the pngs you are going to use, copy them, then navigate to android themes/workspace in there you will find the framework-resapk folder, in there is everything just like the apk so paste the files were they go (that last step can all be done on the computer if that is easier for you.) Next open your nijamorph app and press finish project follow the prompts and let it do its thing. If your phone does not reboot reboot it.you should be good to go.
Like always do a backup before doing these steps
Good luck
Sent from my unrEVOked using xda app
Max_Pain said:
Thats what I do for non system apps. I'll give it a try in the morning and see if it makes a difference.
Swyped from my HTC Evo 4G on the MetroPCS 1X network!
Click to expand...
Click to collapse
it works the same way when replacing pngs. compiling and recompiling is only needed if making xml/code changes. i had to learn this the hard way too. just make sure you sign system apps with option 12 instead of option 4 like you would with a non-system app.
t3project said:
To change pngs only, you should use option 1 (extract) in apk manager. Then change all your pngs you want changed. Use option 3 to recompress your framework. Make sure to tell it that it is a system apk, and then use option 12 to resign. You should be good to go.
Click to expand...
Click to collapse
this worked!
dont know why I would have to extract, replace, compress, as I've NEVER done that with framework-res.apk, only when editing apps that need to be resigned. oh well, it worked
I think you misunderstood what I told you in the guide I gave you which is you only need to decompile/recompile when you are making XML code changes as stated above in a previous post. When I wrote that guide for you I wrote it thinking you wanted to add more features to the original power control widgets (such as smooth mods). If you want to simply replace PNGs, as stated previously, all you need to do is replace the PNGs without decompiling and recompiling.
In this instance, the problem you're running into is that you're trying to compile the framework using already-customized PNGs which will not work (another point that was stated in the guide as well )
So, in conclusion, if all you want to do is change the PNGs all you gotta do is (and you probably already know this but I'm including it to be thorough):
- Open archive (framework) in 7-zip
- Navigate to framework-res/res/drawable-hdpi
- Add your desired PNGs into the 7-zip window
- Close the 7-zip window and answer yes when 7zip asks if you want to update the archive
- Flash framework onto your phone
- All should be well
- When using this method there is no signing necessary!
Again, as stated previously, the only time you need to decompile/recompile is when you're going to edit an XML (or make any other code changes). So, for a final example of this, let's say you wanted to take DaGunn's power widgets framework but you wanted to change the "text highlight" color. What you would do then is this:
- Decompile DaGunn's framework in APK manager (option 9)
- Navigate to /projects/framework-res.apk/values/styles..xml
- Search for for "<item name="textColorHighlight">" and change the color HEX code
- Save the changes to styles.xml
- Compile the framework in APK manager (option 11)
- When asked if this is a system apk answer Y for yes
- When asked if you want to copy additional files to reduce the amount of errors answer Y for yes
- When prompted about the "keep" folder, open a file manager and navigate to /<apk_manager_folder>/keep and DELETE the resources.arsc file
- Go back to the APK manager window and press any button to finish the compile process
- Back in your file manager, go back to /<apk_manager_folder>/place-apk-here-for-modding/ folder, grab the unsignedFramework-res.apk, rename it to framework-res.apk and flash it however you flash it.
- Test your changes (in this example, the text highlight color)
This concludes my post.
thanks for the clarification beat.
but the problem was I was just opening framework-res.apk with 7zip, doing it like you're saying to do in the first part of your post above, and the battery meter would disappear instead of showing the mattedblues battery images instead of the circle ones.
if i left his .pngs in, the battery would show. if i replaced his with mine using 7zip, the battery would disappear.
this confused me because this is exactly the way that I've been integrating mattedblues into every framework i get. i open in 7zip, replace existing files with my own, and bam, everything works. this time it didnt!
this got fixed by extracting, replacing, and compressing again in apk manager 4.9.
i tried decompiling/recompiling simply because I was so out of ideas as to how else to go about it. I don't need to make any .xml changes to DaGunn's file because he had already integrated most of smooth sense with the percentage battery and v2 of the power widgets
anyways, thanks for the clarification.
beatblaster said:
So, in conclusion, if all you want to do is change the PNGs all you gotta do is (and you probably already know this but I'm including it to be thorough):
- Open archive (framework) in 7-zip
- Navigate to framework-res/res/drawable-hdpi
- Add your desired PNGs into the 7-zip window
- Close the 7-zip window and answer yes when 7zip asks if you want to update the archive
- Flash framework onto your phone
- All should be well
- When using this method there is no signing necessary!
Click to expand...
Click to collapse
max, not sure why this wouldnt work for you.
t3project said:
max, not sure why this wouldnt work for you.
Click to expand...
Click to collapse
no. this method is SUPPOSED TO WORK, as I said in the original post. this is how I've done every single change to framework-res.apk in the past. that is why I felt the need to ask for help. because the same thing that has always worked, suddenly wasn't working anymore!
for some reason, using 7zip WAS NOT WORKING to replace the battery .pngs....but ONLY those files. every other file was replaced using 7zip and they all worked. the only files I ended up having to replace through apk manager extract/compress method you gave me were the battery images.
thanks everyone
Max_Pain said:
no. this method is SUPPOSED TO WORK, as I said in the original post. this is how I've done every single change to framework-res.apk in the past. that is why I felt the need to ask for help. because the same thing that has always worked, suddenly wasn't working anymore!
for some reason, using 7zip WAS NOT WORKING to replace the battery .pngs....but ONLY those files. every other file was replaced using 7zip and they all worked. the only files I ended up having to replace through apk manager extract/compress method you gave me were the battery images.
thanks everyone
Click to expand...
Click to collapse
ohh i know. i use the way i told you because i just like to see the images while im playing with them. that way i know for sure whats up.

[Q] system apk

what is considered a system apk? framework-res.apk? com.htc.resources.apk?
all files with com. in front of them? all files in the /system/app/ ? I'm using apk_manager_4.9 to experiment with some simple theming and at one point during zipping it ask if it's a regular apk or a system apk. I haven't a clue. I've only messed with Gmail.apk and I considered it a system apk from the file location it was in. Did I guess right?
In apk manager system apk is a question that, if answered yes, will prompt to keep other files (such as the signature) when recompiling the apk.
In apk manager there is a little hint about when you would choose yes or no to system app. It just takes a little bit of reading.
When in doubt just choose yes to system app and the follow up question. When the apk is recompiled you will have "unsignedxxx.apk". Copy that unsigned file somewhere and then sign the apk. Now you have a signed and unsigned version of the recompiled apk. If the unsigned version doesn't work try the signed version. If that doesn't work then you need to go back and see what you changed that might be causing the issue.
thanks, good info. I can work with that.
Which one would be the first pick to try to install, signed or unsigned. Guess I should go find out the difference.
Sent from my PC36100 using XDA App

Recompile apks

Everywhere i look redirects to apkmanager.. Which is not working for me.. Can someone tell me the manual way to recompile an apk.. Or an alternative to apk manager...
Sent from my SPH-D710 using XDA Premium App
What apps are you trying to mod?
What OS?
agat63 said:
What apps are you trying to mod?
What OS?
Click to expand...
Click to collapse
I got it figured out, was trying to mod Blend ICS apps.. need de-odexed ones..
Ok new question.. This is obviously my first time figuring out how to put these back together... heres my issue: Im using the multi-tool the app im adjusting is mms.apk.. after I extract and edit the images in the res folder I choose option 3 to zip it up and then 5 to zip align and then it creates the new unsigned apk, which I then rename to Mms.apk ... when I dump it onto my phone it doesnt have the icon in astro, it looks like the white icon with the gear on it.. when i try to install it gives a parsing error... I assume its because its a system file and I need to adb it onto the phone.. but why isnt it showing up with the original mms icon? and then secondly.. I cant get multitool to adb push to my galaxy s2 it just says waiting on device.. is there something I need to do besides usb debugging and connect it to the computer? sorry for all the noobness.. gotta start somewhere right?
Oh also Im using fireworks to edit the png's and exporting them back and i noticed when i sent it back out it was like 29kb so I image export and optimized down to 2kb does that even matter?
You can't dump unsigned app into your phone.
I never workred with tool you mentioned but I think you should have sign option there.
Or you just drug modified images and xml files from that unsigned app into your original one.
It has the option to have signed or unsigned ... both ways result in the same issue...
As I said try to drag modded files and png's into original app and try to flash that.
agat63 said:
As I said try to drag modded files and png's into original app and try to flash that.
Click to expand...
Click to collapse
Ok trying..
Worked like a charm.. Makes me wonder what the point of apk manager is at all? Just 7zip unzip.. Edit and rezip...
Sent from my SPH-D710 using XDA Premium App
You can't edit xml files if you just unzip them. You have to decompile them in order to be able to edit them.

Categories

Resources