FORUMS
Remove All Ads from XDA

[MOD][TEMPLATE] APK-Patcher Lite

3,069 posts
Thanks Meter: 7,097
 
By djb77, Recognized Developer / Contributor on 18th November 2018, 12:42 PM
Post Reply Email Thread
APK-Patcher Lite

Flashable Zip Template for Modifying System APKs On-Device
Based on APK-Patcher by @osm0sis


Information

This is a modified version of APK-Patcher that will delete / inject files into System APK files instead of using a baksmali / apktool method.
The method used here is a similar method used in my ROMs to patch files, where instead of having to have like for example 4 SystemUI files, I only needed to keep the actual files that were changed.
This method could also be used quite easily to apply OTA updates or addons on already pre-modified APK files.

LINK TO GITHUB (STANDARD): https://github.com/djb77/APK-Patcher-Lite
LINK TO GITHUB (MAGISK): https://github.com/djb77/APK-Patcher-Lite_Magisk

Usage
  • Copy your pre-compiled resource files (including .dex files) to the patch folder, removing the .apk part of the filename (ie: SystemUI)
  • Create a file in scripts with the same name (ie: SystemUI.sh) if you want to delete any existing files from the APK
  • Make edits to envvar.sh, and also to extracmd.sh if needed

Properties / Variables (envvar.sh)

banner="";
apklist="";
apkbak=/data/media/0/APK-Backup;
backup=1;
cleanup=1;

banner is the name of your patch zip, usually suggestive of what it does, to be displayed at the beginning of the zip flash. You should include your name/handle here like "by osm0sis @ xda-developers" for credit purposes.

apklist is a string containing the list of APKs to be patched included in the patch zip, separated by spaces between the quotes. Each APK is automatically found recursively in /system, then copied to the working directory to be decompiled and acted on, then copied back to /system.

apkbak is the location to place backups of the untouched APKs in apklist if backup=1 is set.

backup=1 will store backups of the untouched APKs in the location specified in apkbak.

cleanup=0 will keep the zip from removing it's working directory in /tmp/apkpatcher - this can be useful if trying to debug in adb shell whether the patches worked correctly. cleanup=1 is necessary on multi-APK patching zips, so it's recommended each APK to be patched be tested on their own with cleanup=0 before combining into a single zip.

envvar.sh

Modify the envvar.sh to add your banner, apklist, backup and cleanup options
Multiple files can be patched, put a space between the filenames (ie: apklist="file1.apk file2.apk"

extracmd.sh

Modify the extracmd.sh to add any additional commands to be performed at the end of the patching process that aren't patch-related (/data file changes,

scripts/$apkname.sh

fileremove="";

$apkname is the name of the folder that you put your resources files in. Copy scripts_sample.sh and rename it to your APK (ie: SystemUI.sh)

Multiple files can be deleted, put a space between the paths (ie: fileremove="/res/drawable/file1.png /res/drawable/file1.png"
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20181118-225612_Magisk Manager.jpg
Views:	1540
Size:	460.4 KB
ID:	4646448  
Attached Files
File Type: zip APK-Patcher-Lite-v1.0.zip - [Click for QR Code] (506.3 KB, 978 views)
File Type: zip APK-Patcher-Lite_Magisk-v1.0.zip - [Click for QR Code] (511.2 KB, 980 views)
The Following 13 Users Say Thank You to djb77 For This Useful Post: [ View ]
 
 
18th November 2018, 01:03 PM |#2  
Senior Member
Flag /home
Thanks Meter: 1,676
 
Donate to Me
More
Good job, mate. Usefull for a 5-SystemUI ROMs
The Following User Says Thank You to AbrahamGC For This Useful Post: [ View ] Gift AbrahamGC Ad-Free
18th November 2018, 02:07 PM |#3  
haifish9999's Avatar
Senior Member
Flag Ha Noi
Thanks Meter: 2,349
 
Donate to Me
More
Good job as usual..... mate
The Following User Says Thank You to haifish9999 For This Useful Post: [ View ] Gift haifish9999 Ad-Free
18th November 2018, 02:20 PM |#4  
Ouweshs28's Avatar
Senior Member
Flag Bon Acceuil, Flacq
Thanks Meter: 1,549
 
Donate to Me
More
Nice one mate
Can't wait to try it out
The Following User Says Thank You to Ouweshs28 For This Useful Post: [ View ] Gift Ouweshs28 Ad-Free
18th November 2018, 02:24 PM |#5  
edzamber's Avatar
Senior Member
Thanks Meter: 3,359
 
Donate to Me
More
Well done, good job bro
The Following User Says Thank You to edzamber For This Useful Post: [ View ] Gift edzamber Ad-Free
18th November 2018, 02:25 PM |#6  
Member
Thanks Meter: 6
 
More
Can I use this to get more coins in wonka's world of candy?
18th November 2018, 02:50 PM |#7  
AttoR's Avatar
Senior Member
Thanks Meter: 306
 
More
NICE...
1st December 2018, 03:24 AM |#8  
Good work djb77
9th May 2019, 08:23 PM |#9  
Member
Flag Bogor
Thanks Meter: 8
 
More
Replied to wrong thread
17th May 2019, 01:40 AM |#10  
Senior Member
Thanks Meter: 8
 
More
Could this modify an apk's screen orientation?

For months i've been trying to get USTVHUB to open on my Shield TV on 8.0 but wont because the app only opens in portrait mode-meant for phones only.
This app works on my S7 or phones. But no matter which screen orientation app i try, and tried editing code, the app crashes every time on my Shield tv because that's landscape mode.
If the OP app wont work for this can someone point me in the direction of something that would work to change an apk's screen orientation?



logo of apk
Attached Thumbnails
Click image for larger version

Name:	logo1.png
Views:	60
Size:	31.3 KB
ID:	4760072  
19th May 2019, 02:48 AM |#11  
djb77's Avatar
OP Recognized Developer / Contributor
Flag NSW
Thanks Meter: 7,097
 
Donate to Me
More
Quote:
Originally Posted by dovedescent7

Could this modify an apk's screen orientation?

For months i've been trying to get USTVHUB to open on my Shield TV on 8.0 but wont because the app only opens in portrait mode-meant for phones only.
This app works on my S7 or phones. But no matter which screen orientation app i try, and tried editing code, the app crashes every time on my Shield tv because that's landscape mode.
If the OP app wont work for this can someone point me in the direction of something that would work to change an apk's screen orientation?



logo of apk

My module will work if you give it the right files to inject, what files/resources my module injects into an APK is your responsibility.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes