Sunday, September 4, 2016

[Tutorial] How to XML edit System apks without breaking Animations in Stock ROMs

There are already many tutorials and tips for editing Android XML files. However everything I tried resulted in choppy System Animations in Stock Motorola ROMs. It's most obvious in drop-down menu animations. This information is based on working with Android 6.0 Stock, however should apply to all previous versions of Android. Also this tutorial may apply to other Motorola phones - different generations of Moto E / G - Moto X / Z etc.


Required Tools:
(*) Latest Apktool
(*) 7zip or alternative capable of exploring apk contents
(*) Notepad++ (if using Windows)

XML files in /res/xml/:

Example #1: framework-res.apk

[Step 1 - Install framework-res]
apktool if framework-res.apk
[Step 2 - Decompile framework-res]
apktool d framework-res.apk
<edit files in /res/xml with Notepad++>

[Step 3 - Build new framework-res.apk]
apktool b framework-res
Go to /framework-res/dist and you will find the new modified apk. DO NOT PUT THIS APK IN YOUR ROM OR ON YOUR PHONE.

Instead, you now need to extract the modified file(s) from /res/xml to a folder. These xml files will be encoded so cannot be viewed in Notepad++.

Next open the original (unmodified) framework-res.apk and browse to /res/xml. Delete the files you want to replace. You can now drag and drop the modified xml files into the original apk and you are done.

Note: You may need to cleanly install the ROM on your phone with the modified framework-res.apk already included.

The above instructions should apply when editing the /res/xml/ files of any system apk, however always begin with Step 1.

------------------------------------------------------------------------------------------------------------------------------------------------------------------

XML files in /res/values: (These files when encoded are contained within resources.arsc)

Example #2: SystemUI.apk

[Step 1 - Install framework-res]
apktool if framework-res.apk
[Step 2 - Decompile SystemUI]
apktool d SystemUI.apk
<edit files in /res/values with Notepad++>

[Step 3 - Build new SystemUI.apk]
apktool b SystemUI
Go to /framework-res/dist and you will find the new modified apk. DO NOT PUT THIS APK IN YOUR ROM OR ON YOUR PHONE.

Instead, you now need to extract the new resources.arsc from this modified apk to a folder.

Next open the original (unmodified) SystemUI.apk. Delete the resources.arsc and drag and drop the new resources.arsc extracted from the modified apk into the original apk and you are done.

Note: You may need to cleanly install the ROM on your phone with the modified apk already included.

The above instructions should apply when editing the /res/values/ files of any system apk, however always begin with Step 1.


from xda-developers http://ift.tt/2bPvc5d
via IFTTT

No comments:

Post a Comment