This commit is contained in:
isPointer
2026-06-11 09:28:03 +06:00
committed by GitHub
parent 2856eca66b
commit 7c7387d032
+19 -44
View File
@@ -78,8 +78,8 @@ public class Main {
mergedApkFile = new File(output.get_out(inputApk, name));
System.out.println("[BUILD] Writing merged APK...");
writeWithProgress(module, mergedApkFile);
System.out.println("\n[MERGE] APK merged successfully: " + mergedApkFile.getAbsolutePath());
loading.progress(module, mergedApkFile);
System.out.println("[MERGE] APK merged successfully: " + mergedApkFile.getAbsolutePath());
}
if (translatePath != null) {
@@ -91,15 +91,15 @@ public class Main {
String tn = mergedApkFile.getName();
int td = tn.lastIndexOf('.');
tn = (td > 0 ? tn.substring(0, td) : tn) + "_translated.apk";
File transFile = new File(output.get_out(inputApk, tn));
System.out.println("[BUILD] Building Translated APK...");
writeSilently(module, transFile);
System.out.println("[BUILD] Translated APK built at: " + transFile.getAbsolutePath());
} else {
System.err.println("[ERROR] Translation file not found: " + translatePath);
}
} else if (!inputPath.endsWith(".apk")) {
File transFile = new File(output.get_out(inputApk, tn));
System.out.println("[BUILD] Building Translated APK...");
output.write(module, transFile);
System.out.println("[BUILD] Translated APK built at: " + transFile.getAbsolutePath());
} else {
System.err.println("[ERROR] Translation file not found: " + translatePath);
}
} else if (!inputPath.endsWith(".apk")) {
// Default logging patch only if merging and no translation requested
System.out.println("[INFO] Patching classes.dex for logging...");
try {
@@ -111,13 +111,13 @@ public class Main {
String pn = mergedApkFile.getName();
int pd = pn.lastIndexOf('.');
pn = (pd > 0 ? pn.substring(0, pd) : pn) + "_pairip.apk";
File paiFile = new File(output.get_out(inputApk, pn));
System.out.println("[BUILD] Building Logging APK...");
writeSilently(module, paiFile);
crc32.patch(mergedApkFile, paiFile);
System.out.println("[BUILD] Logging APK built at: " + paiFile.getAbsolutePath());
}
File paiFile = new File(output.get_out(inputApk, pn));
System.out.println("[BUILD] Building Logging APK...");
output.write(module, paiFile);
crc32.patch(mergedApkFile, paiFile);
System.out.println("[BUILD] Logging APK built at: " + paiFile.getAbsolutePath());
}
System.out.println("[BUILD] Process completed");
@@ -130,29 +130,4 @@ public class Main {
}
}
}
private static void writeWithProgress(ApkModule module, File file) throws IOException {
int total = module.getZipEntryMap().size();
if (module.hasTableBlock()) {
total--;
}
int[] count = {0};
final int finalTotal = total;
module.writeApk(file, new WriteProgress() {
@Override
public void onCompressFile(String path, int method, long length) {
count[0]++;
loading.progress(count[0], finalTotal);
}
});
loading.progress(finalTotal, finalTotal);
}
private static void writeSilently(ApkModule module, File file) throws IOException {
module.writeApk(file, new WriteProgress() {
@Override
public void onCompressFile(String path, int method, long length) {
}
});
}
}
}