1
0
Fork 0
mirror of https://github.com/Radiquum/anixart-patcher.git synced 2025-09-05 10:45:32 +05:00

[E] Extend cleanup patch to remove .line n from smali and compress Image resources

Fixes #3
This commit is contained in:
Kentai Radiquum 2025-09-02 10:03:39 +05:00
parent 7b5ba163bd
commit df74e0cac2
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
2 changed files with 102 additions and 9 deletions

View file

@ -39,7 +39,12 @@ def decompile_apk(apk: str):
stderr=subprocess.PIPE,
)
except subprocess.CalledProcessError as e:
log.fatal(f"error of running a command: %s", e.stderr, exc_info=True)
log.fatal(
f"error of running a command: %s :: %s",
f"java -jar {config['folders']['tools']}/apktool.jar d -f -o {config['folders']['decompiled']} {config['folders']['apks']}/{apk}",
e.stderr,
exc_info=True,
)
exit(1)
@ -63,13 +68,22 @@ def compile_apk(apk: str):
stderr=subprocess.PIPE,
)
except subprocess.CalledProcessError as e:
log.fatal(f"error of running a command: %s", e.stderr, exc_info=True)
log.fatal(
f"error of running a command: %s :: %s",
f"java -jar {config['folders']['tools']}/apktool.jar b -f -o {config['folders']['dist']}/{apk} {config['folders']['decompiled']}",
e.stderr,
exc_info=True,
)
exit(1)
def sign_apk(apk: str):
log.info(f"sign and align apk: `{apk}`")
command = ""
try:
command = (
f"zipalign -p 4 {config['folders']['dist']}/{apk} {config['folders']['dist']}/{apk.removesuffix(".apk")}-aligned.apk",
)
result = subprocess.run(
f"zipalign -p 4 {config['folders']['dist']}/{apk} {config['folders']['dist']}/{apk.removesuffix(".apk")}-aligned.apk",
shell=True,
@ -78,6 +92,10 @@ def sign_apk(apk: str):
# stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
)
command = (
f"apksigner sign --ks ./keystore.jks --out {config['folders']['dist']}/{apk.removesuffix(".apk")}-aligned-signed.apk {config['folders']['dist']}/{apk.removesuffix(".apk")}-aligned.apk",
)
result = subprocess.run(
f"apksigner sign --ks ./keystore.jks --out {config['folders']['dist']}/{apk.removesuffix(".apk")}-aligned-signed.apk {config['folders']['dist']}/{apk.removesuffix(".apk")}-aligned.apk",
shell=True,
@ -87,5 +105,5 @@ def sign_apk(apk: str):
stderr=subprocess.PIPE,
)
except subprocess.CalledProcessError as e:
log.fatal(f"error of running a command: %s", e.stderr, exc_info=True)
log.fatal(f"error of running a command: %s :: %s", command, e.stderr, exc_info=True)
exit(1)