Skip to content

Commit 2cc69f4

Browse files
author
WindySha
committed
Fix zipalign apk failed error
1 parent bda1dc0 commit 2cc69f4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

xpatch/src/main/java/com/storm/wind/xpatch/util/FileUtils.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,15 @@ private static void compressFile(File file, ZipOutputStream zipOut, String baseD
240240
ZipEntry originEntry = getZipEntryFromZipFile(originZipPath, file.getName());
241241
System.out.println(" file name : " + file.getName() + " originEntry = " + originEntry);
242242
if (originEntry != null) {
243-
entry.setMethod(ZipEntry.STORED);
244-
entry.setSize(originEntry.getSize());
245-
entry.setCompressedSize(originEntry.getCompressedSize());
246-
entry.setCrc(originEntry.getCrc());
243+
long size = originEntry.getSize();
244+
long comrepssSize = originEntry.getCompressedSize();
245+
System.out.println(" originEntry = " + originEntry + " size = " + size + " comrepssSize = " + comrepssSize);
246+
if (size == comrepssSize) {
247+
entry.setMethod(ZipEntry.STORED);
248+
entry.setSize(originEntry.getSize());
249+
entry.setCompressedSize(originEntry.getCompressedSize());
250+
entry.setCrc(originEntry.getCrc());
251+
}
247252
}
248253
}
249254
zipOut.putNextEntry(entry);

0 commit comments

Comments
 (0)