Skip to content

Commit

Permalink
Fixing issue with Android R+
Browse files Browse the repository at this point in the history
  • Loading branch information
Eltion committed Jun 24, 2022
1 parent 948bd2e commit 9b417e8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions patch_apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def zip_align_apk(apk):
print("Running zipalign...")
tmp_apk = apk.replace(".apk","_tmp.apk")
shutil.move(apk, tmp_apk)
subprocess.call('zipalign -p -f 4 {0} {1}'.format(tmp_apk, apk), stderr=subprocess.STDOUT, shell=False)
subprocess.call('zipalign -p -f 4 {0} {1}'.format(tmp_apk, apk), stderr=subprocess.STDOUT, shell=True)
os.remove(tmp_apk)


Expand Down Expand Up @@ -169,10 +169,8 @@ def patch_apk(apk):
apk_out = ZipFile(os.path.join(TEMP_FOLDER, "new_apk.apk"), "w")
files = apk_in.infolist()
for file in files:
if not os.path.exists(os.path.join(TEMP_FOLDER, file.filename)) and not file.filename.startswith("META-INF\\") and not file.filename.startswith("resources.arsc"):
if not os.path.exists(os.path.join(TEMP_FOLDER, file.filename)) and not file.filename.startswith("META-INF\\"):
apk_out.writestr(file.filename, apk_in.read(file.filename), compress_type=file.compress_type, compresslevel=9)
if not os.path.exists(os.path.join(TEMP_FOLDER, file.filename)) and file.filename.startswith("resources.arsc"):
apk_out.writestr(file.filename, apk_in.read(file.filename), compress_type=zipfile.ZIP_STORED, compresslevel=0)
apk_in.close()
libfolder = os.path.join(TEMP_FOLDER, "lib")
for (root, _, files) in os.walk(libfolder, topdown=True):
Expand Down

0 comments on commit 9b417e8

Please sign in to comment.