Signing framework-res.apk - Android Software/Hacking General [Developers Only]

i got a question for someone obviously brighter than me.... i made some higher level mod's to my framework-res.apk utilizing apkmanager... i was able to decompile and compile with no errors but i need it signed so i can push it .... i used apkmanagers signing utiliy but i get fc's like crazy.. i got the same result using android kitchen signing utility... i can copy over the res folder into another apk but its the resources.arsc i need too and when i copy it over i get a bootloop aswell..
before you respond... i need this file to be able to be pushed .. i know i can create and update.zip and sign the zip but that isnt going to work for what i'm trying to do
any help would be greatly appreciated

Copying resources.arsc to original apk and using update.zip gives me bootloop aswell. Just not funny, I can't flash my phone to test every possible combination.

Too bad you can't use AVD to flash roms... hmmm

Related

Problem with framework-res...

So, i need some help from you.
Everytime I put some statusbaar icons into the framework-res.apk and resign it, it stucks in a boot loop.
In ddms it says me that the package android (i think its a file in the framework-res, or the framework-res) isn't signed correctly.
I attached the statusbaricons and the WORKING framework-res.
Could someone please integrate the files in the res/drawables folder and sign it correctly for me?
Thank you..
You would get a credit in my rom ;-) (Yes, i know, it's not very well known :-D , my roms name is MaxismaR, just search for it here..)
P.S: I'm on Windows 7, maybe that affects the signing process..
maxisma said:
So, i need some help from you.
Everytime I put some statusbaar icons into the framework-res.apk and resign it, it stucks in a boot loop.
In ddms it says me that the package android (i think its a file in the framework-res, or the framework-res) isn't signed correctly.
I attached the statusbaricons and the WORKING framework-res.
Could someone please integrate the files in the res/drawables folder and sign it correctly for me?
Thank you..
You would get a credit in my rom ;-) (Yes, i know, it's not very well known :-D , my roms name is MaxismaR, just search for it here..)
P.S: I'm on Windows 7, maybe that affects the signing process..
Click to expand...
Click to collapse
What are you using to sign? Keytools/Jarsigner?
I'm using the autosign.exe.
Ahh, Try my attachment.
Ok, tried and it gives me this :
06-18 21:52:40.797: ERROR/PackageManager(77): Package android signatures do not match the previously installed version; ignoring!
have you tried deleting the META-INF folder before you sign?
maxisma said:
Ok, tried and it gives me this :
06-18 21:52:40.797: ERROR/PackageManager(77): Package android signatures do not match the previously installed version; ignoring!
Click to expand...
Click to collapse
I've come across that error before, it's just telling you the current installation of framework-res doesn't match the signatures with the one you're trying to reinstall. I believe this framework jar file is located only in /system/framework so you would first have to remove any reference to the file (basically uninstall it). I know you can't uninstall a jar but basically you need to remove references to the file and signature of the file before you can replace it. It's possible you only need to remove /system/framework/framework-res.jar and /data/dalvik-cache/*framework-res*
I can't guarantee that if you remove this file that android will still boot up without errors. Be prepared to have to wipe and reload
why not take a full ROM update and put your images into that and then sign it. also make sure your images aren't too big. if you are using linux you can use pngcrush otherwise i'm no help
But there's no framework-res.jar in there.
But will try wiping after installing the new framework-res ;-)
If u r including icons like battery, check the number of icons in the framework of hero & that of ur rom, if it dosent mach, try removing or incliding some more or ger the source cod & insert those hero stuff inor source code & rebuild rom then get both framework res apk & the jar file....
thats the way i had implemented the percentage battery statusbar icons into 1.5
I know your always supposed to resign the apk's but the only workaround I have found for the exact same problem is to put.zip at the end of framework-res.apk.Right click on it explore to what directory im inserting my images in and paste em while leaving it zipped,when done take .zip back off dont sign it and it works then in the update.
THX to crotalusfreak! That fixed it! You'll get a credit in my next upload ;-)

replacing framework-res.apk?

(basically im tryna put villians themed framework-res into sanpeis latest rom)
ok i found this ROM with a modded taskbar thing... the battery icon, 3g icon, etc were different.
i took the framework-res.apk from that rom and replaced it with the one already in my phone but now my phone wont pass the second flashscreen even if i leave it for half an hour.
wtf i checked the permissions of the new framework-res and made it to match the rest of the files in the system/framework folder but nothing changed
is it just not compatible?
if you change it it has to be from same style rom, if it's a legend rom you need one from legend rom, you cannot mix that easy hero and legend framework files
If the only thing you wish to change is those icons, then take both apk files apart with some compression tool(I know 7zip works), find the files that you wanna take from villains that are in res folder and copy them to res folder from sanpeis rom(ofc you need to put them in right folders, but when you open up res folder you'll know what to do. After you replaced those files, take all the files that were from start in sanpeis framework and the edited res folder and create a .zip file. Rename the file to framework-res.apk(no, the name shouldn't be xxxx.apk.zip, but you need to change the extension from zip to apk) and push it like you would normally do. Also you should probably want to know that the more compression, the more likely that the apk will fail So your best bet is to go with store. Good luck
Sent from my HTCMagic using the XDA mobile application powered by Tapatalk
You will have to sign your framework-res.apk using testsign.jar if you have made any changes to it.
Why would he need to do that if he's just going to push it?
klothius said:
Why would he need to do that if he's just going to push it?
Click to expand...
Click to collapse
yea i just want to push it from one legend-based rom to another.. it doesnt work but im going to try to tear them open and see what i can do from there..
Thanks
EDIT: NICEEE i got it working.. and i just replaced a few things from one framework-res to the other.. thanks again, i didnt know it could be opened with 7-zip hahah
No prob, glad to see it's working for ya. Enjoy it
png
i edited 166 icons in framework-res.apk
adb pushed it, worked flawlessly.
even on XDAndroid on htc diamond 2
st0kes said:
You will have to sign your framework-res.apk using testsign.jar if you have made any changes to it.
Click to expand...
Click to collapse
Incorrect. /system/app/*.apk's donot require to be re-signed upong modifying them because the core doesnt no check its certs/hash for consistency. So just pull/modify/push. Use apk manager in my signature if ur new to this

Theming files?

Sorry about the first post. I was wondering where the png files are located in the rom so I can start theming
Sent from my HERO200 using XDA App
If this has been addressed sorry. I searched but didn't find it. If it's been addressed please point me in the right direction. Thanks
Sent from my HERO200 using XDA App
abadasstanker69 said:
If this has been addressed sorry. I searched but didn't find it. If it's been addressed please point me in the right direction. Thanks
Sent from my HERO200 using XDA App
Click to expand...
Click to collapse
Ull find all the PNG in the individual apps in the system/app, system/framework, and data/app.
Papa Smurf151 said:
Ull find all the PNG in the individual apps in the system/app, system/framework, and data/app.
Click to expand...
Click to collapse
Thanks bro! All I see is apk files though. Where are the images?? Also, is there anything specific I have to do in order to export/import the files in Photoshop? I read something somewhere about a .9 PNG or something like that....what does this mean? BTW great work on your theme! It looks awesome! I love it!
Ok I'm a douche bad. lol I renamed the apk to .zip and extracted with winrar. Now I'm in to where I want to be! I'm looking for the little android guy when you make a phone call but, I can't seem to find him in the HTCdialer.apk. Am I looking in the wrong place? Thanks again for the help!
They are in the apk's.
http://developer.android.com/index.html
Good luck.
Ok found the little droid man! This is gonna be awesome!! Any more useful places I should mess around in? This is gonna be FUN!!!!!!!
Ok so I have edited some files and rezipped them. Now do I flash the updated files through recovery or do I have to rename it to .apk and stick it in the rom and re-flash?
abadasstanker69 said:
Ok so I have edited some files and rezipped them. Now do I flash the updated files through recovery or do I have to rename it to .apk and stick it in the rom and re-flash?
Click to expand...
Click to collapse
I may be wrong but I have done the same thing, all I did when I was finished was push them via adb to their respective places and then reboot and it worked fine for me. Nandroid before you push so if it boot loops you can recover. Then the easiest thing at that point would be to save your work in the ROM you modded, push to sd root, wipe and flash it. I am creating a themed version of Darchoid 2.7 but taking my sweet time as I dont have a lot of it to begin with.
For my HTC Keyboard modifications, I just dropped my new images into the APK that was open in 7zip and pushed it to the /system/app/ dir and launched the keyboard, and BAM, my new keyboard.
abadasstanker69 said:
Ok so I have edited some files and rezipped them. Now do I flash the updated files through recovery or do I have to rename it to .apk and stick it in the rom and re-flash?
Click to expand...
Click to collapse
You have to sign it too. If you want to flash it. If you wanna just push it through adb then then put your edited .apk in AndroidSDK\tools and push it.
Go to command prompt:
Code:
cd C:\android-sdk-windows\tools
adb remount
adb push xxxxx.apk /system/app/
exit
C:\android-sdk-windows\tools is assuming thats where your sdk\tools folder is
xxxxx.apk is the name of the .apk
/system/app/ is assuming that's where you got the .apk from
Thanks for all the help guys. I appreciate it but, I was attempting to make an update.zip so people could then flash them once I complete them. I like to make things idiot proof
So I did some looking and found an autosigner. Problem is, now it wants boot scripts? WTF? I know I could push them through adb and simply tell others to do the same. I was just wondering if there was an easy way of doing this? I'm currently using avabox. Thanks again guys!!
abadasstanker69 said:
Thanks for all the help guys. I appreciate it but, I was attempting to make an update.zip so people could then flash them once I complete them. I like to make things idiot proof
So I did some looking and found an autosigner. Problem is, now it wants boot scripts? WTF? I know I could push them through adb and simply tell others to do the same. I was just wondering if there was an easy way of doing this? I'm currently using avabox. Thanks again guys!!
Click to expand...
Click to collapse
Just use a mod or update.zip any will do and add ur files and delete the originals in the zip. Keep the meta file and such. Then u can autosign with avabox. It gets tricky with scripts when making a rom. The update.zip script is very basic
Check This Out
You can just take one from a working zip if you want
Otherwise you will be making a file (i use notepad++) called "update-script" *notice-there is no file extension like .txt or anything*
In general they ususally just have:
Code:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
(but may be different depending on where you want the zip's contents to be put in)
Which will be placed into a folder directory META-INF/com/google/android/update-script
You can also add things such as:
Code:
delete SYSTEM:app/contacts.apk
*or whatever you want deleted*
After you make the update-script, just sign it and flash
See my attachment for a template
[/QUOTE]You can also add things such as:
Code:
delete SYSTEM:app/contacts.apk
*or whatever you want deleted*
After you make the update-script, just sign it and flash
See my attachment for a template[/QUOTE]
What would be the purpose in doing that? Would it actually delete people's contacts if they flashed my theme? That's kinda cool but, I'm not trying to be a **** like that! lol
Also, are you guys referring to an update.zip that's all ready out as in a theme file? Or as in a rom? I understand I can use the work that's all ready there and I actually tried that. I zipped the file back up.Then signed with avabox. Renamed it to .apk. Stuck it back in the rom. Attempted to flash and got the boot script error
abadasstanker69 said:
What would be the purpose in doing that? Would it actually delete people's contacts if they flashed my theme? That's kinda cool but, I'm not trying to be a **** like that! lol
Also, are you guys referring to an update.zip that's all ready out as in a theme file? Or as in a rom? I understand I can use the work that's all ready there and I actually tried that. I zipped the file back up.Then signed with avabox. Renamed it to .apk. Stuck it back in the rom. Attempted to flash and got the boot script error
Click to expand...
Click to collapse
haha i just used contacts.apk as an example, it could be anything you wanted really. But its generally only used for when making an update.zip for boot screens.
And yes, you could take an already existing zip... but i was a little confused as to what you were doing sorry.
Correct me if I'm misunderstanding you again lol, but you're editing images within .apks and want to make a flashable-update.zip once you finish?
Easiest way, as stated before would be to use 7-zip.
Open the .apk Directly with 7-zip (no renaming the .apk to .zip or anything) and drag the replacement images into the .apk - overwriting the older images
Test it by pushing the apk to your phone, if it works without any problems great
If it doesn't then use something like Apk Manager to extract the apk/edit the files/and zip them back up < generally what I do
Put the .apk into the apps folder in my "template update.zip" file
Delete the framework folder and readme.txt file
Sign the .zip
Flash
kyouko said:
haha i just used contacts.apk as an example, it could be anything you wanted really. But its generally only used for when making an update.zip for boot screens.
And yes, you could take an already existing zip... but i was a little confused as to what you were doing sorry.
Correct me if I'm misunderstanding you again lol, but you're editing images within .apks and want to make a flashable-update.zip once you finish?
Easiest way, as stated before would be to use 7-zip.
Open the .apk Directly with 7-zip (no renaming the .apk to .zip or anything) and drag the replacement images into the .apk - overwriting the older images
Test it by pushing the apk to your phone, if it works without any problems great
If it doesn't then use something like Apk Manager to extract the apk/edit the files/and zip them back up < generally what I do
Put the .apk into the apps folder in my "template update.zip" file
Delete the framework folder and readme.txt file
Sign the .zip
Flash
Click to expand...
Click to collapse
LOL I really appreciate the help! You guys kick ass!!!! BUT I tried this method MINUS the renaming part and it didn't work. Sooooo....I'm assuming the renaming caused the issue.
Also, I was using winrar. I read somewhere that 7zip should be used instead of winrar but I just don't think this should matter considering the compression method is no different. Am I wrong? Also, will my theme have to vary from rom to rom? If I create this theme for people will I have to specify what rom I'm on?
Thanks again SOOOOOOOOOO much for the help guys...I know working with noobs can be a headache. I did it in the WinMo world for YEARS till I came to the "Dark Side"
abadasstanker69 said:
LOL I really appreciate the help! You guys kick ass!!!! BUT I tried this method MINUS the renaming part and it didn't work. Sooooo....I'm assuming the renaming caused the issue.
Also, I was using winrar. I read somewhere that 7zip should be used instead of winrar but I just don't think this should matter considering the compression method is no different. Am I wrong? Also, will my theme have to vary from rom to rom? If I create this theme for people will I have to specify what rom I'm on?
Thanks again SOOOOOOOOOO much for the help guys...I know working with noobs can be a headache. I did it in the WinMo world for YEARS till I came to the "Dark Side"
Click to expand...
Click to collapse
Yes 7zip works better for theming and roming. I tried winrar and it was a pain in the ass.
Yes u will have to specify which roms it will work on. Files on darchdroid r different than our 2.1 roms and so forth. So they wont work right.
Download avabox and use the signing tool in there to sign ur zips.
Make sure in ur zip if ur editing an app it's in the right place...ie system/app or system/framework or data/app. Then make sure ur Meta file is in there. After that sign it and then u can change the name and flash it
Papa Smurf151 said:
Yes 7zip works better for theming and roming. I tried winrar and it was a pain in the ass.
Yes u will have to specify which roms it will work on. Files on darchdroid r different than our 2.1 roms and so forth. So they wont work right.
Download avabox and use the signing tool in there to sign ur zips.
Make sure in ur zip if ur editing an app it's in the right place...ie system/app or system/framework or data/app. Then make sure ur Meta file is in there. After that sign it and then u can change the name and flash it
Click to expand...
Click to collapse
I'm such a freaking noob....what's the meta file for? This seems like alot to do for a theme :/
abadasstanker69 said:
I'm such a freaking noob....what's the meta file for? This seems like alot to do for a theme :/
Click to expand...
Click to collapse
The Meta file is for the update script. It has other uses but for ur purpose its for the update script which is the instructions the recovery uses to flash the theme. Like I stated before just use an existing one from a different theme or mod. Creating ur own is possible but not needed. Hit me up on gtalk if u want to ask me questions.
[email protected]
I don't mind teaching if anyone wants to learn

[HOWTO] Theming your framework / apps for newbies ;)

It's not much, but I thought everyone should be able to theme their Framework
Requirements: WinZip(or any other zipping program), Android SDK, testsign, some graphics editor...
NOTE: This will work with theme apk's as well !!!
So what you need to start with is your framework files:
framework-res.apk, com.htc.resources.apk ... both are located in SYSTEM:framework/
These files are just renamed zip files, so rename them back to .zip and extract them (you can also edit them inside WINRAR or something, but it is more comfortable if you extract them)
In these, images are usually saved in res/drawable-mdpi or such, but you have to think here, allways modify all files from one resource
Now locate the images you want to edit but I only know how to edit .png files (.9.png files are for a different howto, probably not by me as I've never really mastered it)
Pick those you want to edit, and edit them (I'm not gonna tell you how here, I usually use photoshop to do that )
Once you have edited those images, it is recomended to optimize those png's (Firstly to make them smaller, but more importantly, most of the times the png's from Windows graphics editor didn't work for me...)
To optimize png's you can use:
OptiPNG: DOWNLOAD This one is drag'n'drop batch conversion capable...
Pngcrush: DOWNLOAD Command line utility, but it has more settings
...or something else, but I find these two the best
Once you have these optimized, copy and re-write them to folders you took them from to edit...
Now you need to zip these back, for framework files I was told it is usual to zip them as "store", but correct me someone if I'm wrong.
After you have zipped those, they will have to be re-signed. To do this, use testsign from code.google.com
Then run this in cmd line (or create a .bat file as I did, it's much easier):
Code:
java -classpath testsign.jar testsign [COLOR="DarkRed"]file.zip[/COLOR] [COLOR="DarkRed"]file-signed.zip[/COLOR]
Now that you have signed it, it is recomended to zipalign it:
(zipalign.exe is located in /tools in your SDK)
Run this in cmd line:
Code:
zipalign 4 [COLOR="DarkRed"]infile.zip[/COLOR] [COLOR="DarkRed"]outfile.zip[/COLOR]
(4 is alignment in bytes)
Now that you have aligned the .zip, rename it to the original name and then you just need to push it back to your phone:
Code:
adb shell mount /system
adb push [COLOR="DarkRed"]com.htc.resources.apk[/COLOR] /system/framework/[COLOR="DarkRed"]com.htc.resources.apk[/COLOR]
or
adb push [COLOR="DarkRed"]framework-res.apk[/COLOR] /system/framework/[COLOR="DarkRed"]framework-res.apk[/COLOR]
And you're done
I hope this helps someone! Enjoy!
note: This way you should be able to modify any apk I think
Very good.
Good initiative, thank you.
Lets hope that others will follow your example and contribute in this community,we need it.
Sent from my HTC Desire S using XDA Premium App
One question... can i change the framework if i'm s-on? And if yes how? flash it through recovery or how?
LE: Thx for the info. I found out how to edit themes... i will create a cool one to upload here. I could edit the framework.....but i am s-on so no use for that.
Unfortunately, when you're unrooted, you can't push files to your system...
But this will work for those Theme apk's too... so grab a theme you like and you can edit it as easily as you would your framework It has a limited potential, but it's something for you S-ON users
Hmm, I skipped the push part and copied the file back over the one in the phone. Now my phone is stuck in a continuous loop on the "quietly brilliant" screen.
Any help? Where do I get a stock rom to flash?
rogbese said:
Hmm, I skipped the push part and copied the file back over the one in the phone. Now my phone is stuck in a continuous loop on the "quietly brilliant" screen.
Any help? Where do I get a stock rom to flash?
Click to expand...
Click to collapse
Just enter recovery & factory reset,wipe, then wipe dev cache, then reflash your rom that you were using before the bootloop.
You can even swap icons in the framework of your rom then just flash (if you try to swap framework.apks or dialer.apks using a file manager you will delete or swap the file but this will cause loads or errors & force closes & then result in your bootloop!) Then just swap via a computer within the zip file then just flash in recovery as normal & if done right you wont get bootloops

HELP with Decompiling APK (using APKTOOL)

I've looked around for some good tutorials on decompiling APKs using APKTool but haven't been able to get a few questions answered. Hoping someone can guide me with this process a bit since I'm really new at it.
A few things first: I am running CM 7.1 on a Droid Incredible (orig) and I'm also on Windows, not Linux. I'm looking to make some changes to the code of an APK and have APKtool downloaded. Questions I have so far are:
1) Do I need to use the CM 7.1 framework-res.apk file for any decompiling / /recompiling work on this 3rd party APK? Or can I do all the work without it? No one seems to have a clear answer on that and I'm not sure exactly what the framework-res.apk is for exactly.
2) After I decompile an APK and make code changes to a SMALI file, is there anything I need to do special before running the compile command?
3) After I have a newly compiled APK, what do I need to do to make this work on my phone? If I do nothing, the overall file size of the compiled APK seems much smaller than the original one that I decompiled so it seems like something is wrong. Plus it won't install. I saw one video where the newly compiled APK is renamed to .ZIP and the contents are put into the ORIGINAL APK (also renamed to .zip), overwriting all the original contents. Is this required?
4) I've also read that APKs need to be signed to install on Android. Is this correct? I found "SignApk" online which seems like it just asks you to rename your APK to app.apk and it does the signing by running a .BAT file. Is that all I have to do before installing the APK on my phone?
Would really appreciate any help on this. Or if there's a great tutorial out there on doing this, I'd be happy to read through.
Thanks for any help in advance!
I want to know these too! Hope someone helps

Categories

Resources