Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,730,580 Members 40,860 Now Online
XDA Developers Android and Mobile Development Forum

TUTORIAL - Swapping out PNG's in .apk

Tip us?
 
itiskonrad
Old
(Last edited by itiskonrad; 29th January 2012 at 02:08 PM.)
#1  
Senior Member - OP
Thanks Meter 221
Posts: 272
Join Date: Dec 2009
Default TUTORIAL - Swapping out PNG's in .apk

Swapping out PNG's!

**This is for system apk's, not for market ones. To modify apps you've downloaded and installed, you will need a program like the fantastic Apk Manager, since non-system apps are signed and have to be resigned after getting messed with**

*MY TYPICAL DISCLAIMER!*
I AM NOT A DEV! I just like tinkering with this phone because I'm overall an extremely picky and obsessive person. I have no prior android experience (besides a little tinkering with my X10), and am in NO way an expert. But since I know how to mess with my phone a little bit and I've been asked to share, I will =) But follow these instructions at your own risk! I am not responsible for the untimely death of your phone, so please be cautious and careful, and if you have any questions about any step, before you try it, ask me or someone who knows! I don't want the blood of your dead phone on my hands! It's Christmas, after all! =)
These instructions are for Windows computers. Sorry, I'm just not familiar with mac or linux. =(


***Swapping out PNG's***

Okay, so say you have an icon or an image in your phone that you just don't like and would like to swap out with something (or swap out with nothing, so you can't see it at all). Here is what you'll need:

7zip for your computer
Root explorer for your phone
Some kind of image editor. I'm partial towards Paint.net. =) (Only if you're actually going to edit an image. If you're just going to swap it out for something else, you obviously won't need this.)

Here is a good example of something where I really felt like I needed to change some images we can use that I just discovered last night while calling to activate my credit card over the phone. Here is the dialer when you start the phone:



Notice those handy letters next to the numbers =)
Once I started the call to the credit card company, it asked me to verify myself by inputting, using the keypad, the letters of my mother's maiden name. So I opened the dialer, and what did I see?



For whatever STUPID STUPID REASON, they REMOVE the letters next to the numbers on the keypad that opens DURING the call, making it extremely difficult for me to type my mother's maiden name in the time permitted, given that no, I don't off the top of my head know where the letters sit on the dialer. So I felt this needed fixing =)

1.) Copy the apk you want to modify from your phone (using root explorer) and transfer to your computer

In this case, I wanted my Phone.apk, which is in /system/app. The vast majority of system apps are in this folder with the major exception of framework-res.apk, which is the phone’s BIG cajone in /system/framework, and as such, should be handled with utmost care. Messing with framework-res.apk incorrectly is an EASY way to brick your phone in a heartbeat.

2.) Unzip the apk using 7zip and look for your PNG's!

Keep the original, untouched, zipped apk somewhere safe on your computer. You’re going to need one to modify and another copy for safekeeping in case you want to revert back to the stock apk, or something goes wrong. Unzipping the apk just makes searching for the PNG you’re looking for much easier, since you can change the folder view in windows to give you a thumbnail of each of the items. And lookee, lookee, here they are in phone/res/drawable-hdpi, right next to other dial buttons with those handy letters!!



3.) Edit your PNG's however you want.

In this case, the work is pretty much done for us! I just swapped out the PNG's without the letters for copies of the ones with the letters, and just changed the names of the files to the original versions, like so:



4.) Using 7zip, right click on the original, untouched apk, choose 7zip, and open archive. DO NOT EXTRACT.

Open archive will let you explore the apk without having to extract it and lose the proper packaging of the apk.

5.) Select all your newly modified PNG’s and drag and drop them into the correct location in the open archive of the original apk, letting them overwrite the old PNG’s.

6.) Put this newly modified apk back onto your phone. Using root explorer, copy the new apk into the /system folder of your phone.

7.) CHANGE THE PERMISSIONS of the apk to match those of the original apk in /system/app.

In this case, long press on the phone.apk, select permissions, and select the check boxes as follows- Owner: Read, Write; Group: Read; Others: Read. This matches the permissions of phone.apk in /system/app

8.) Move the new apk into /system/app, and let it overwrite the original!

9.) Restart your phone!

Voila! Now when I call my credit card company and have to type in names, I can!

The Following 8 Users Say Thank You to itiskonrad For This Useful Post: [ Click to Expand ]
 
stephensonbrady
Old
#2  
stephensonbrady's Avatar
Member
Thanks Meter 17
Posts: 88
Join Date: Sep 2010
Location: thousand oaks
Just got my nitro yesterday. your mod worked like a charm.
 
hyelton
Old
#3  
hyelton's Avatar
Recognized Contributor
Thanks Meter 2179
Posts: 4,717
Join Date: May 2010
Location: Wilmington

 
DONATE TO ME
Well I cant use it:/ Anything I try I get Access Denied! Using Windows 7. Getting it with 7-zip and Winrar same error just access denied or storage full when trying to copy over a PNG.
My Build: ASRock 970 Extreme4 | Amd FX-6300 OC to 4.5Ghz | Nvidia GTX-650-Ti | 8GB 1600 | 120GB Samsung 840 SSD | 500GB Hard Drive | Windows 7 Pro | NZXT 810 White Case.
Current Phone: Sony Xperia Z1 (White)

Check out my Personal site and Photography www.hunterspad.com

Please Click Thanks If I helped you in any way!
If you need anything Hosted Or mirrored: Send a PM my Way
My Server Specs: 24X Intel Xeon E5-2620 2.1Ghz,32GB Ram,2TB HD
 
PMad
Old
(Last edited by PMad; 14th March 2012 at 02:29 AM.)
#4  
PMad's Avatar
Senior Member
Thanks Meter 41
Posts: 146
Join Date: Sep 2010
Location: Oregon
Quote:
Originally Posted by hyelton View Post
Well I cant use it:/ Anything I try I get Access Denied! Using Windows 7. Getting it with 7-zip and Winrar same error just access denied or storage full when trying to copy over a PNG.
You need to copy the file to your SD card, no other place.. And when using Root Explorer, you have to make sure that when your in the System/app folder, you have to tap the button at the top of the screen that says "Mount R/W" and when you do, the button will change to "Mount R/O", that will allow you to modify things in that folder.

---------- Post added at 06:23 PM ---------- Previous post was at 06:15 PM ----------

Here's my problem:

I follow the instructions to the T, after changing the permissions of the file, i paste it in the System/App folder and immediately the phone app starts force closing, constantly non stop. I have to hold the power button to bring up the menu and mash the force close button as fast as i can until my finger ends up hitting the power off button that is underneath the force close button, than i can hit the ok button and restart. When i do that and the phone boots back up, some phone storage thing force closes a few times, then after a few minutes the phone app itself force closes, and regardless of anything, my modifications are never there!

If i try to call anybody, my phone loads skype and calls, and if i try to call voicemail, i get ANOTHER force close, android.process.acore

Also, my phone is stuck with no signal, probably why skype tries to load..

I'm assuming this is because my phone is completely stock with root? I need to deodex it to do this stuff right?
The Following User Says Thank You to PMad For This Useful Post: [ Click to Expand ]
 
PMad
Old
#5  
PMad's Avatar
Senior Member
Thanks Meter 41
Posts: 146
Join Date: Sep 2010
Location: Oregon
Ok so I did it again, but this time, instead of making my own custom PNG files, i copied the ones with the letters, renamed them to the names of the ones without the letters, pasted them back, overwrote them, added them to the APK, and put it back on the phone.. Same problems happened, but i noticed something.

When changing the permissions of the file in Root Explorer, they dont stick.. Once i open up the permissions window again they are back to the way they were before, so i can only change the permissions of the file after copying it over and rebooting. I have all the same problems as before, except once i change the permissions of the file and reboot, everything seems to work fine once the phone is fully booted up, and the changes stuck.

So seems there's an issue with something im doing with the new PNG files, or 7zip isnt reconstructing the file 100% back to normal but close, or something... Either way, now im off to one change at a time! ugg...
 
PMad
Old
#6  
PMad's Avatar
Senior Member
Thanks Meter 41
Posts: 146
Join Date: Sep 2010
Location: Oregon
Found my issue! I totally missed step 6 for some reason! Haha all good now
 
iJimaniac
Old
#7  
iJimaniac's Avatar
Senior Member
Thanks Meter 414
Posts: 1,352
Join Date: Oct 2011
Location: Douglas, AZ

 
DONATE TO ME
Okay, so nice tutorial! I am just wondering since you say framework-Res.apk is so dangerous, are you saying I could brick my device using this method, or is this method fine? I am not going to mess with the .9 pngs, just regular pngs.
Get R.E.D.D ->> Got R.E.D.D? <<- Get R.E.D.D

Asking an ETA for a rom is like asking for a hug from Chuck Norris. Moral: NO ETA'S!

Flashing CyanogenMod on a YP-G1 before backing up the EFS is like punching Chuck Norris before you're ready to die. Moral: ALWAYS BACKUP YOUR EFS!
 
itiskonrad
Old
#8  
Senior Member - OP
Thanks Meter 221
Posts: 272
Join Date: Dec 2009
This method is fine, but you have to be very careful to follow the protocol precisely (in particular, the parts about using root explorer and changing permissions properly). If you have any questions, please ask. And as usual, be sure to have both a nandroid and titanium backup of your phone juuust in case of the unexpected...
 
Ticklefish
Old
#9  
Ticklefish's Avatar
Recognized Themer
Thanks Meter 3091
Posts: 3,565
Join Date: Oct 2011
Location: UK
Quote:
Originally Posted by iJimaniac View Post
Okay, so nice tutorial! I am just wondering since you say framework-Res.apk is so dangerous, are you saying I could brick my device using this method, or is this method fine? I am not going to mess with the .9 pngs, just regular pngs.
.9 png's aren't that bad, as long as you know what to do with them.

To put in one simple line....don't touch the 1 pixel wide border around the edge!!

That's it really. The border isn't part of the image, it's instructions for stretching the image. As long as you avoid changing it, you can change the actual image itself as much as you like.


- Tickle My Android 9.1 -

Making Theming Android Fun!


Decompile Files, Change Icons, Change Fonts,
Change Boot Animations, Create Flashable Zips, Deodex Roms
..And More!


http://forum.xda-developers.com/showthread.php?t=1633333
 
Pankaj05
Old
#10  
Junior Member
Thanks Meter 1
Posts: 10
Join Date: Jun 2012
Hey.....thank u for the tutorial.....
i tried replacing the png's in Framework-res.apk.....there was a change in the size of the apk
and when i copied it in system/framework phone wont boot....but am able to go into recovery.....

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Hide Numbers on Your SMS and Call Logs with Reflection

How many times have you given your device to someone else in order to show them a … more

Implement Split View in Your LG G2 KitKat Rom with Automated Installer

Some of you may have remembered a story on the Portal a few weeks back … more

Cast Your Device Screen the Way it Was Meant to be with Second Screen

Not too long ago here on the XDA Portal, we covered how Google had made … more

Samsung Gear Live Unboxed the XDA Way – XDA Developer TV

XDA Developer TV Producer AdamOutleris known for his XDA Unboxingseries where … more