I’m trying to open a big (around 1 GiB) zip file in Android using java.util.zip API and get the following error:
java.lang.OutOfMemoryError
at java.util.HashMap.makeTable(HashMap.java:555)
at java.util.HashMap.doubleCapacity(HashMap.java:575)
at java.util.HashMap.put(HashMap.java:405)
at java.util.zip.ZipFile.readCentralDir(ZipFile.java:366)
at java.util.zip.ZipFile.<init>(ZipFile.java:132)
at java.util.zip.ZipFile.<init>(ZipFile.java:103)
at com.foo.bar.zip.archive.ZipArchive.<init>(ZipArchive.java:44)
I completely understand that the size of the file exceeds the memory limit by a big margin, but is there any workaround for the issue? Thanks in advance.
I suspect the problem is not the size of the file but the number of entries as it is failing when caching the Zip table entries.
Your own options are to;