New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
vimjam
Old
(Last edited by vimjam; 11th September 2011 at 11:52 AM.)
#1  
vimjam's Avatar
Senior Member - OP
Thanks Meter 607
Posts: 568
Join Date: Dec 2008
Location: HYDERABAD,INDIA
Cool [TUTORIAL][updated 11/9] ANDROID .xml(decryption) & .9.png EDITING

I am not a developer myself , i did learn few thing through various search sites & posts (most frustrating way), today wildfire owners are desperately requesting for few tweaks , roms (SFM) etc , to be frank wildfire is loosing its developers(sorry dev's)due to new & improved phones being released in the market which are greater than our's

================================================== ===============================


CONTENTS:
Post 2 : how to edit .9 images
Post 3 :apk manager method

USEFUL LINKS

1.EVERY NEWBIE MUST READ THIS POST

2.BASIC JAVA , ANDROID JAVA TUT

3.ANDROID KITCHEN (basic)

4.ROM BUILDING GUIDE(bit outdated)

================================================== ===============================
htc wildfire(sold)(12/01/11)
SE Xperia Neo V(broken)(18/11/12)
Samsung galaxy tab 7.0'(sold)(09/08/12)
htc explorer(12/12/12)

My Work

[NEO V] ALL IN ONE THREAD
[THEME] wildDAZZLER THEME v0.2
[TUTORIAL]ANDROID .xml(decryption) & .9.png EDITING


#490+ inbox PM's , enough guys IF YOU HAVE ANY QUERIES PLEASE ASK FOR HELP IN RESPECTIVE THREAD , let others know the problem & solution to it
The Following 3 Users Say Thank You to vimjam For This Useful Post: [ Click to Expand ]
 
vimjam
Old
(Last edited by vimjam; 11th September 2011 at 11:58 AM.)
#2  
vimjam's Avatar
Senior Member - OP
Thanks Meter 607
Posts: 568
Join Date: Dec 2008
Location: HYDERABAD,INDIA
1.EDIT .9 IMAGES

DESCREPTION:
.9 images are basically PNG images , but are modified to specify a few extra expandable instrustions such as HEIGHT , WIDTH . These images are compiled in draw9patch of sdk & are encrypted via eclipse software


REQUIRED SOFTWARE:
1.WinRar(or any other zip tool)
2.Android sdk manager (draw9patch)
3.eclipse IDE for java developers(download it from www.eclipse.org)
4.image editor(i use paint.net tool)

PROCEDURE:

As an example i am using cm7 nightly & i am editing a .9 image in systemui.apk(theme related file) which is in System>app folder

EDIT : now you can download the attachment or can directly see my example images in post itself

__________Extracting Image__________

1.open the cm7 zip via winrar , navigate to app folder which is in system folder
**cm7nightly 170.zip

2. double click on the systemui.apk & a new window pops up with the contents in the syatemui.apk
[COLOR="Red"]**cm7nightly 170.zip>systemui.apk

3.all images are in res folder(common for any app) go to res folder
**cm7nightly 170.zip>systemui.apk>res

4. now you have to keep in mind that all the images used by that particular apk are in RES folder & are kept in sub folders named starting with 'drawable' as
drawable-ldpi,drawable-mdpi,drawable-hdpi,drawable
**cm7nightly 170.zip>systemui.apk>res>drawable-ldpi , ref image step2

5.go to drawable-ldpi and extract those image to any folder in your pc
**c:/vimjam/desktop/myfolder , ref image step3

6. rename that image which you want to edit by removing the .9 in the name(original image name : header.9 edit it to header)
**c:/vimjam/desktop/myfolder/header.png , ref image step4

7.edit that image as you wish & save it in .png file only
**c:/vimjam/desktop/myfolder/header.png

8.now open draw9patch.jar which will be in the following folder x1:/x2/Android\android-sdk\tools\lib (x1 refers to your C drive or D drive or whatever partition where you installed your sdk)(x2 refers to program files folder or program files(x86) in few windows versions)
**c:/program files(x86)/android/android-sdk/tools/lib/draw9patch.jar

9.drag your edited image on the draw9patch window , then it will show as the screen shot given below
**c:/program files(x86)/android/android-sdk/tools/lib/draw9patch.jar , ref image step5


__________.9 Image Editing__________

10.this is the part where you encode .9 script on your image

11.basically what draw9patch does is it gives a black lining at the ends of the image(which are to be specified by us)which are later encrypted as instructions in eclipse software)

12.in draw9patch first tick the show patches option

13.now you have to experiment a little bit to understand this procedure , when you left click at the edges of the image a black spot appears that black spot is the .9 code
**right click on that black spot to erase it

14. for now see the screen shots and do the black lining just as what i did(type 1) (do not use the black line at round edges(only at rectangular edges)(refer type 2 image for more details)**after you've completed the procedure use the lining as done in type2 screenshot provided below , ref image type1

15. save that image with the same name as the original file (see screen shot named savetype)(you can see that the image still contains these black dots , dont worry its natural)
**c:/vimjam/desktop/myfolder/header.9.png , ref image header.9


__________Eclipse Encryption__________

16.this is the part where you complete the encryption using ECLIPSE

17. now open eclipse , click new>project>android>android project , ref image step6

18.a new window opens fill the details (refer my pic named demo)(i use the word demo in the details you can use any other) & click finish , ref image step7

19. now expand the demo project , you can see a couple of things like src , gen... ignore them except res folder , ref image step8

20.expand res folder , drag the .9 patched image(which you edited using draw9patch.jar) in drawable-xxx
(xxx refers to ldpi or hdpi or mdpi )

**NOTE: if your edited image is from drawable-ldpi place it in drawable-ldpi only similarly hdpi to hdpi , mdpi to mdpi only , ref image step8

21. right click on the demo folder project & click on android tools , and then on
EXPORT UNSIGNED APPLICATION PACKAGE.... & save your file
**your saved file will be demo.apk , ref image step8

22.now drag that saved file into any zip file(don use the cm7 nightly zip) or you can create a zip archive of that demo.apk which is generated by eclipse
** compress demo.apk to demo.zip

23. open the demo.zip archive, double click on demo.apk , navigate to res , drawable-ldpi and extract the header.9.png image

24. now open cm7nightly170.zip , navigate to systemui.apk , double click on it , click res,drawable-ldpi & now drag the previous image which you extracted from the demo.zip archive ,then the winrar will ask for confirmation click ok
** cm7nightly170.zip>systemui.apk>res>drawable-ldpi , ref image step9

25.dont close the cm7 nightly zip yet , after you clicked ok the winrar will ask for a save confirmation to save changes in parent folder click yes and close it .done
(this confirmation will be small & will be hidden behing other open windows/applications so check carefully & do not miss this confirmation) , ref image step10

now you can flash that nightly file via recovery,same procedure can be applied to any .9 images of any apk

==========================================



EDIT2: UPDATED IMAGE SCREENSHOTS , PLACED ALL IMAGE EXAMPLES IN ".9 IMAGE EXAMPLES.RAR" FILE
**RAR FILE CONTAINS ALL THE IMAGES WITH LITTLE EXPLANATION IN THE IMAGES ITSELF TO UNDERSTAND THIS PROCEDURE DOWNLOAD THAT RAR FILE(contains no virus its my word)
Attached Files
File Type: rar .9 image examples.rar - [Click for QR Code] (1.29 MB, 109 views)
htc wildfire(sold)(12/01/11)
SE Xperia Neo V(broken)(18/11/12)
Samsung galaxy tab 7.0'(sold)(09/08/12)
htc explorer(12/12/12)

My Work

[NEO V] ALL IN ONE THREAD
[THEME] wildDAZZLER THEME v0.2
[TUTORIAL]ANDROID .xml(decryption) & .9.png EDITING


#490+ inbox PM's , enough guys IF YOU HAVE ANY QUERIES PLEASE ASK FOR HELP IN RESPECTIVE THREAD , let others know the problem & solution to it
The Following 4 Users Say Thank You to vimjam For This Useful Post: [ Click to Expand ]
 
vimjam
Old
(Last edited by vimjam; 31st August 2011 at 01:45 AM.)
#3  
vimjam's Avatar
Senior Member - OP
Thanks Meter 607
Posts: 568
Join Date: Dec 2008
Location: HYDERABAD,INDIA
***EDIT : using apk manager to recomoile a sense apk is causing few errors , although decompiling is working fine


Another easier way is to just decompile the framework using apk manager, and editing the .9 png on photoshop since you can edit the black patches as well and just recompile @kevin2516


you can also use apk manager to decrypt .xml files

here are the links for apk manager 4.9 & 5.0 (detailed method will be published soon)

for version 4.9 http://forum.xda-developers.com/showthread.php?t=695701
for version 5.0 http://forum.xda-developers.com/show....php?t=1227179

guys as my suggestion use the apk manager method only to decompile the apk's ,(compiling them is kinda messy)(1 out of 5 times the files ive compiled caused force close so better safe than sorry)

procedure:
1. place the apk you want to edit in the folder named "place apk here for modding"
2.double click script file a cmd opens(if it shows java not found error then watch this video and get it right http://www.youtube.com/watch?v=X05JPrto_c8)
3.type 22 and hit enter
4.enter its the apk file's no which you want to edit
5.type 9 and hit enter
6.it might show some errors ignore them
7.now go to project folder which will be in the same place in apk manager folder
8.now open any .xml file with any text editor (i use notepad++)(you can also edit .9 images this way)
9.do the required changes & save it
10.type 11 if what you are editing is a system apk
11.else use 14
12.if your choice was 11(in cmd) then a the cmd will ask few confirmations(type y for both)
13. a new folder gets created by name keep
14.go to that folder and delete every file that you've changed & if you have edited a .xml file then delete the resources.arsc(else dont)
15.after doing this press any key in cmd done
16.a file by the name unsigned.apk will be created in the place the apk here for modding folder
16.sign that file if it is not a system apk , & replace it in your rom
htc wildfire(sold)(12/01/11)
SE Xperia Neo V(broken)(18/11/12)
Samsung galaxy tab 7.0'(sold)(09/08/12)
htc explorer(12/12/12)

My Work

[NEO V] ALL IN ONE THREAD
[THEME] wildDAZZLER THEME v0.2
[TUTORIAL]ANDROID .xml(decryption) & .9.png EDITING


#490+ inbox PM's , enough guys IF YOU HAVE ANY QUERIES PLEASE ASK FOR HELP IN RESPECTIVE THREAD , let others know the problem & solution to it
The Following User Says Thank You to vimjam For This Useful Post: [ Click to Expand ]
 
pyroblazer
Old
#4  
Senior Member
Thanks Meter 7
Posts: 333
Join Date: Oct 2010
Location: Ahmedabad
good going mate... I'm desperately waiting to get over with my CAT exams in November... then I'll give my sole into developing!!!
 
vimjam
Old
#5  
vimjam's Avatar
Senior Member - OP
Thanks Meter 607
Posts: 568
Join Date: Dec 2008
Location: HYDERABAD,INDIA
oh that's great & all the best for your CAT exam , i am planning for CAT in the coming years
htc wildfire(sold)(12/01/11)
SE Xperia Neo V(broken)(18/11/12)
Samsung galaxy tab 7.0'(sold)(09/08/12)
htc explorer(12/12/12)

My Work

[NEO V] ALL IN ONE THREAD
[THEME] wildDAZZLER THEME v0.2
[TUTORIAL]ANDROID .xml(decryption) & .9.png EDITING


#490+ inbox PM's , enough guys IF YOU HAVE ANY QUERIES PLEASE ASK FOR HELP IN RESPECTIVE THREAD , let others know the problem & solution to it
 
kevin2516
Old
#6  
kevin2516's Avatar
Recognized Themer
Thanks Meter 1336
Posts: 3,717
Join Date: Sep 2010
Location: Sydney
Another easier way is to just decompile the framework using apk manager, and editing the .9 png on photoshop since you can edit the black patches as well and just recompile

Sent from somewhere far far away.
The Following User Says Thank You to kevin2516 For This Useful Post: [ Click to Expand ]
 
ErwinP
Old
#7  
Senior Member
Thanks Meter 849
Posts: 576
Join Date: Oct 2010

 
DONATE TO ME
Quote:
Originally Posted by kevin2516 View Post
Another easier way is to just decompile the framework using apk manager, and editing the .9 png on photoshop since you can edit the black patches as well and just recompile

Sent from somewhere far far away.
I don't know how it goes with you, but I have always a bootloop when I do that. Probably because the signature isn't correct.

So perhaps to complement Kevin: after recompiling, you can take your modified files out of your "new" apk and put it in the "old" one, and then flash the "old-new hybrid" apk.

Erwin
Erwin
HTC Wildfire - AlphaRevX HBOOT 6.01.1002
Recovery: Arco68's custom ClockworkMod v4.0.1.4
ROM: CyanogenMod 9.0 [KANG]
Github: ErwinP
 
kevin2516
Old
#8  
kevin2516's Avatar
Recognized Themer
Thanks Meter 1336
Posts: 3,717
Join Date: Sep 2010
Location: Sydney
Quote:
Originally Posted by ErwinP View Post
I don't know how it goes with you, but I have always a bootloop when I do that. Probably because the signature isn't correct.

So perhaps to complement Kevin: after recompiling, you can take your modified files out of your "new" apk and put it in the "old" one, and then flash the "old-new hybrid" apk.

Erwin
For the framework-res.apk you don't sign it.

They would work too if the above doesn't.

Sent from somewhere far far away.
 
3xeno
Old
#9  
3xeno's Avatar
Recognized Contributor
Thanks Meter 1385
Posts: 3,528
Join Date: Dec 2010
Location: Pune
Quote:
Originally Posted by pyroblazer View Post
good going mate... I'm desperately waiting to get over with my CAT exams in November... then I'll give my sole into developing!!!
You are not giving any of the other mgmt exams after that? Just CAT?

/ENd OT
Samsung Galaxy SII GT-I9100 - CM10.1 | LGE Google Nexus 4 16GB - CM10.1
iPod Touch 3rd Gen - iOS 5.1.1 JB | B&N Nook Simple Touch - Stock
Device History -
Nokia 5110 >> Nokia 8310 >> Nokia N-Gage QD >> Nokia 6681 >> Nokia N82 >> Nokia 5320 XM >> HTC Wildfire


 
vimjam
Old
(Last edited by vimjam; 3rd September 2011 at 02:57 AM.)
#10  
vimjam's Avatar
Senior Member - OP
Thanks Meter 607
Posts: 568
Join Date: Dec 2008
Location: HYDERABAD,INDIA
EDIT : NVM
htc wildfire(sold)(12/01/11)
SE Xperia Neo V(broken)(18/11/12)
Samsung galaxy tab 7.0'(sold)(09/08/12)
htc explorer(12/12/12)

My Work

[NEO V] ALL IN ONE THREAD
[THEME] wildDAZZLER THEME v0.2
[TUTORIAL]ANDROID .xml(decryption) & .9.png EDITING


#490+ inbox PM's , enough guys IF YOU HAVE ANY QUERIES PLEASE ASK FOR HELP IN RESPECTIVE THREAD , let others know the problem & solution to it