[TUT] Advance Framework Edit - XPERIA X8 Android Development

things you'll need
APK MANAGER
7zip
DESCRIPTION :
Q : Basic
A : The icons are stored in the Drawable-mdpi folder in the framework.
these icons are linked to XML's in Drawable folder
if you just add the icons and don't change the xml, you'll get nothing.
Q : Why Cant we just Edit the XML files?
A : The XML files are encrypted. if you try to edit it you will get weird characters.
Q : No XML No Edits, Are we Done?
A : Yes, No XML No Edits. But we've a walkaround. The APK MANAGER
it decompiles the apk and unencrypts the xml file.
BASIC :
Extract the contents of APK MANAGER to any folder
you'll have few folders
place your apk in the place-apk-here-for-modding folder
open Script.bat
and chose option to decompile and minimize
it will create a folder namely PROJECTS
now you can edit the xml files
after your done, maximize the apkmanager window and choose comiple apk
HOW TO ADD MORE PNGS :
if you want to add pngs like the battery percentage you'll need to link the png to the xml file
this can be done by two ways
1. assigning resource_id
&
2. directly putting in the names
the 1st method is easy but complex so forget it
the second method is simpler.
just find the xml file corresponding to the png and than simply add the name.
for eg.
stat_sys_battery.xml is the battery status xml.
<item android:drawable="@drawable/stat_sys_battery_0" android:maxLevel="0" />
Click to expand...
Click to collapse
here the
android:drawable is the android code
and
@drawable/stat_sys_battery_* is the file location
check the attachment for better understanding
Click to expand...
Click to collapse
THE PROBLEM & THE SOLUTION :
if you try to edit any modded framework file you'll get error while compiling.
and your phone will hang if you use that file.
SOLUTION
instead of using modded file. use the STOCK framework. Edit your files and compile your apk
now when you compile it, it will give you few options
1. is it a system file [y/n]
choose yes
2. (...blah blah.. do you wish to keep files)
choose yes
now it will extract the stock (unedited) framework in a KEEP folder
minimize the window
open the folder and delete all the files you modified.
if you had modified xml file you'll also need to delete resources.asrc
now maximize the apkmanager window and press any key.
your modded apk will be compiled in the place-apk-here-for-modding folder
PS : IT WOULD BE UNSIGNED
LAST STEP :
open the compiled unsigned apk and extract all the files you edited (including resources.asrc)
simply replace these files in the framework-res.apk you wanted to mod
only part to take care is the resources.asrc file you don't have to replace it directly
do this steps for replacing resources.asrc
1. right click the resources.asrc
2. select add to archive
3. archive format zip
4. compression method Store
5. select the path of your framework-res.apk
I know this all seems way to complex but if you read carefully and do it step by step, its all easy as a PIE

Related

[Q] replacing lockscreen image?

I've been looking everywhere all weekend for this. Where do i locate the lockscreen slider image in order to replace with a custom one? looked all through internal memory and i know it's in a .apk file but which one? i hope somebody can help me with this, thanks in advance.
you have to pull the framework-res.apk file. You also have to be rooted to do this. It should be in system/framework
That should be in /system/framework/framework-res.apk. Once you get that you will need to decompile it with a program like apk Manager, edit the draw-9 pngs, then recompile it with apk Manager.
The reason that you should decompile it is that the lockscreen images that you want to edit are draw-9 png images. Draw-9 pngs are resizable by the system because they have an outer border on all images that tell it how to stretch. When you simply extract them from the framework-res.png, with a program like winzip, they lose that outer border. You need to decompile them in order to maintain that border when you edit them. Recompile them afterwards and then you can put that framework-res.apk on the phone with the new lockscreen.
Download apk Manager
Now here is what I've learned about apk Manager:
put framework-res.apk in the place-apk-here-for-modding folder
run the script
enter 22 to select an apk, then 1 to select your apk
press 9 to decompile the apk
go into the projects/framework-res.apk/res/drawable-hdpi folder and edit your pngs (maintain the border)
go back to the script once your done editing and enter 11 to compile
when asked if it is a system apk enter y
when asked if you want to extract other files too enter y
go into the keep folder that was created and delete any pngs that you changed in the projects folder
if you change any xml files, you will also need to delete the resources.arsc file from the keep folder
go back to the script and press any key to continue
your recompiled framework-res will be in the place-apk-here-for-modding as unsigned-framework-res.apk
extract unsigned-framework-res.apk using winzip, or similar program (this is being it is compressed incorrectly)
go into the folder where you just unzipped the framework and zip it up with the compression mode set to Store - call it framework-res.apk
you are ready to go with a properly editing framework-res.apk, put it on your phone any way you like
Make sure that you have no errors when de-compiling or re-compiling. It might seem like everything is going ok, but you could end up soft bricking your phone if you don't check the log.txt in the apk Manager main folder. Check the log.txt after every decompile and recompile to ensure that you don't have a damaged framework-res.apk.
The output in log.txt should like like this for a proper decompile:
Code:
--------------------------------------------------------------------------
|Sun 05/01/2011 -- 20:11:47.57|
--------------------------------------------------------------------------
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
Could Not Find C:\Users\jbush\Documents\Custom Atrix\Programs\apk_manager_4.9\place-apk-here-for-modding\../place-apk-here-for-modding/signedframework-res.apk
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
And like this for a proper recompile:
Code:
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
(skipping index file 'C:\Users\jbush\Documents\Custom Atrix\Programs\apk_manager_4.9\other\..\projects\framework-res.apk\assets\images\Thumbs.db')
(skipping index file 'C:\Users\jbush\Documents\Custom Atrix\Programs\apk_manager_4.9\other\..\projects\framework-res.apk\assets\webkit\Thumbs.db')
The system cannot find the file specified.
If you get any errors about your images then you need to fix them before you can recompile.
thanks, gettin to work on it now.
Replace lockscreen image
I did not use any special software for this. Just copied (using Root explorer on device) file \system\framework\framework-res.apk to sdcard, then easily copied it to PC desktop. Opened the file with Winzip, extracted image zzzzzzzz_default_lockscreenw.jpg (may be the image name is different on your device, so it's better you preview it in order to compare with your lockscreen image) just to notice the image size. Removed the image from apk. Without closing the winzip window I made an image of the same size and name. Then I dragged it inside the Winzip window. Then used reverse steps to put it back in \system\framework.
That's it!

Open XML file

I had extract surces files from an .apk application and I'd like to open XML files in the folder "res"
I import it in eclipse but i obtain this message:
"No XML content. Please add a root view or layout to your document."
you're right !
xml files in res folder doesn't seem to be real xml but "DBase 3 data file"
-> using the "file" command (on linux)
res/layout$ file main.xml
main.xml: DBase 3 data file (864 records)
Why not just use Notepad++ or Geany(Linux) ? That how i edit xml files.
smokin1337 said:
Why not just use Notepad++ or Geany(Linux) ? That how i edit xml files.
Click to expand...
Click to collapse
If anybody want to edit an xml inside an apk, he must decompile with proper decompiler (apktool) . Then only he can edit the xml with notepad or gedit or Geany .
Simple extracting of xml file will that suffice. XML extracted from apk with a zip manager , may not even viewed properly with notepad gedit or Geany .
yeah, you must decompile the .apk , then you can edit the xml file by a text editor.
Yes, you cannot just unzip the .apk and edit the files. You must de compile the apk first:
http://code.google.com/p/android-apktool/
It is easy, then you can edit all you want.
Then: compile, zip, sign.

[Q] How can I recompile system apk using ONLY APKTool while keeping signature?

I don't want to use APK Multi-Tools or APK_Manager or whatever. I want to know exactly what those tools are doing in order to recompile the system apk while keeping the original signature.
What I initially did...
Code:
apktool d "%~dpnx1.apk" "%~dpnx1"
...modify files here...
apktool b "%~dpnx1" "%~dpnx1.apk"
But obviously that's unsigned. I need to sign it, but I want to use the original signature, which I'm guessing is the META-INF stuff, right?
So I attempted this...
Code:
apktool d "%~dpnx1.apk" "%~dpnx1"
7za x -o"%~dpnx1-signature" "%~dpnx1.apk" META-INF -r
...modify files here...
apktool b "%~dpnx1" "%~dpnx1.apk"
7za a -tzip "%~dpnx1.apk" "%~dpnx1-signature/*" -mx9
You'll notice I now use 7-Zip to pull out META-INF from the original APK and then insert it back into the recompiled one afterwards.
The only other thing I can think of would be to go with my first method, but then use 7-zip to pull out the compiled files from the unsigned apk and insert them into the signed apk. I haven't tried that yet, but it will be the next one I go with. Every time this fails, though, I have to do a nandroid restore, and it's getting a little frustrating, which is why I'm asking you folks.
--
edit: I got it all figured out.
For those interested, after running "apktool b" (to build/compile), ignore the output zip. Instead go into the source directory and there is now a build directory. In that is an apk directory. Simply add your changed files to the original untouched APK (if you modified any XML files, then replace resources.arsc; if you added anything to smali, then replace classes.dex; if you added any XML files, then you need to include those as well; for me, i copied resources.arsc, classes.dex, and one new XML file). I used the following command:
Code:
zip -9 ..\SystemUI.apk res\layout\status_bar.xml classes.dex resources.arsc
I use zip instead of 7za for cosmetic reasons. You can also use "7za a -tzip etc..." if you want.
hello i know how you feel well....i never did.
you keep a backup and a copy of your system apk and once you did your changes look in your copy and go to /res and delete the destinations you modded and putted them in the modded apk now look into your modded apk file in /res and take the files you deleted from the copy apk and move them to the copy apk and your all set.
if this didnt understand ill show you an awesome thread that will help you
sorry i didnt see your edited section

Where can I find files with button names in an .apk file?

Hi, let me explain.
I'm translating a gamebook app for Android. So far I've managed to decompile the .apk file, find and edit the .xml files with storyline, but I cannot find the files that contain the data about the app menu buttons (options, settings, save/load etc.). The decompiled game folder contains following folders:
- assets (.xml files with story)
- original
- smali
- smali_classes2
- unknown
- AndroidManifest XML document and apktool YML file
I tried opening random smali files with EditPlus, but couldn't find anything. Any tips how can I edit those buttons? Where to find the code? I just want to change the text to another language.

How to decode and Encode file AndroidManifest.xml in folder Original ?

Hi guys,
Can you tell me how to decode and Encode file AndroidManifest.xml in folder Original after decompiled a apk by apk easy tool ?
Tks!
Link file : drive.google.com/file/d/1IhfDhrEBTTlQA7NzvRBLiDrR3MR8usVT/view?usp=sharing
MinhFtuer said:
Hi guys,
Can you tell me how to decode and Encode file AndroidManifest.xml in folder Original after decompiled a apk by apk easy tool ?
Tks!
Link file : drive.google.com/file/d/1IhfDhrEBTTlQA7NzvRBLiDrR3MR8usVT/view?usp=sharing
Click to expand...
Click to collapse
Weird, AndroidManifest.xml is supposed to be decoded. The fact that it remains in the original folder is weird, did you try doing it with apktool only ? (With apk easy tool)
Super simple, just install apktool (if not already installed and working without apk easy tool)
To test if it's working without APK easy tool open a command prompt and enter "apktool --version", if it returns something, then it's good, if not, you're good to set it up yourself in a separate folder, here is the guide from the apktool website: https://ibotpeaches.github.io/Apktool/
Enter the command "apktool d [name of the apk].apk" to decompile your apk, you should have everything.
And if you don't want to bother your with all of that, I can decompile the APK for you and send you the AndroidManifest.xml file decompiled.
Have a good day
Raiz said:
Weird, AndroidManifest.xml is supposed to be decoded. The fact that it remains in the original folder is weird, did you try doing it with apktool only ? (With apk easy tool)
Super simple, just install apktool (if not already installed and working without apk easy tool)
To test if it's working without APK easy tool open a command prompt and enter "apktool --version", if it returns something, then it's good, if not, you're good to set it up yourself in a separate folder, here is the guide from the apktool website: //ibotpeaches.github.io/Apktool
Enter the command "apktool d [name of the apk].apk" to decompile your apk, you should have everything.
And if you don't want to bother your with all of that, I can decompile the APK for you and send you the AndroidManifest.xml file decompiled.
Have a good day
Click to expand...
Click to collapse
Thanks for your reply, I have tried to decompile that apk by your way but file AndroidManifest.xml in folder ...original\AndroidManifest still be encoded. Can you help me decode it as you said that ?
Link down this apk :drive.google.com/file/d/18HjRivgkNjixCdO823CJD2mxLxr6QuEQ/view?usp=sharing .Remember that I need to decode file AndroidManifest.xml in folder original which contains both of folder META-INF
MinhFtuer said:
Thanks for your reply, I have tried to decompile that apk by your way but file AndroidManifest.xml in folder ...original\AndroidManifest still be encoded. Can you help me decode it as you said that ?
Link down this apk :drive.google.com/file/d/18HjRivgkNjixCdO823CJD2mxLxr6QuEQ/view?usp=sharing .Remember that I need to decode file AndroidManifest.xml in folder original which contains both of folder META-INF
Click to expand...
Click to collapse
That's a huge apk, what is it? 1,2 Gb I've never seen that before. I'll just send you here the AndroidManifest.xml text. You'll then have to copy/past it into a text editor, and rename the file "AndroidManifest.xml".
Edit #1: I can't even decode the APK, can you tell me what is this file and where you got it from ? The apk file size limit is 100MB , what is this file ?
Edit #2 : Usually the AndroidManifest.xml isn't encoded at all, you just have to browse the APK with a zip explorer to find this file and read it. I personally won't do that as this file is very suspicious... 1,3 Gb for an APK... Apktool doesn't recognize it... This is really weird, I recommend you just to trash it.
@MinhFtuer
To decode a binary AndroidManifest.xml file you use axmldec: Android Binary XML Decoder.
jwoegerbauer said:
@MinhFtuer
To decode a binary AndroidManifest.xml file you use [github.com/ytsutano/axmldec"] axmldec: Android Binary XML Decoder[/url].
Click to expand...
Click to collapse
Great, I can do it by your way, can you teach me how to encode back it tks ?

Categories

Resources