Xamarin Android: System.IO.Compression.ZipFile.ExtractToDirectory Release Mode Failure

Everything works fine in debug mode, but when we run it in release, the ExtractToDirectory call fails.

Here is the function for the link. Just to make sure we're not doing anything weird.

private bool UnzipFiles() { bool toReturn = true; try { UpdateStatus("Almost done..."); string file = Path.Combine (DownloadFolder, "ZipFile.zip"); if(System.IO.Directory.Exists(UnzippingDestinationFolder)) { System.IO.Directory.Delete(UnzippingDestinationFolder, recursive:true); } System.IO.Compression.ZipFile.ExtractToDirectory(file, UnzippingDestinationFolder); UpdateStatus("Finished!"); var files = System.IO.Directory.GetFiles(UnzippingDestinationFolder); int m = 3; } catch (Exception e) { toReturn = false; } 

Finally, here is the exception we get.

 System.NullReferenceException: Object reference not set to an instance of an object at SharpCompress.Common.Zip.Headers.ZipFileEntry.DecodeString (System.Byte[] str) [0x00000] in <filename unknown>:0 at SharpCompress.Common.Zip.Headers.DirectoryEntryHeader.Read (System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0 at SharpCompress.Common.Zip.ZipHeaderFactory.ReadHeader (UInt32 headerBytes, System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0 at SharpCompress.Common.Zip.SeekableZipHeaderFactory+<ReadSeekableHeader>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0 at SharpCompress.Archive.Zip.ZipArchive+<LoadEntries>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0 at SharpCompress.LazyReadOnlyCollection`1+LazyLoader[SharpCompress.Archive.Zip.ZipArchiveEntry].MoveNext () [0x00000] in <filename unknown>:0 at System.IO.Compression.ZipArchive.CreateZip (System.IO.Stream stream, ZipArchiveMode mode) [0x00000] in <filename unknown>:0 at System.IO.Compression.ZipArchive..ctor (System.IO.Stream stream, ZipArchiveMode mode, Boolean leaveOpen, System.Text.Encoding entryNameEncoding) [0x00000] in <filename unknown>:0 at System.IO.Compression.ZipFile.Open (System.String archiveFileName, ZipArchiveMode mode, System.Text.Encoding entryNameEncoding) [0x00000] in <filename unknown>:0 at System.IO.Compression.ZipFile.ExtractToDirectory (System.String sourceArchiveFileName, System.String destinationDirectoryName, System.Text.Encoding entryNameEncoding) [0x00000] in <filename unknown>:0 at System.IO.Compression.ZipFile.ExtractToDirectory (System.String sourceArchiveFileName, System.String destinationDirectoryName) [0x00000] in <filename unknown>:0 at NewBaron.Screens.DownloadContentScreen.UnzipFiles () [0x00000] in <filename unknown>:0 
+5
source share
2 answers

Minor changes in Victor’s decision. Non-binding SDK generated apk, which was 53 MB. Too large to limit the apk file size for the store.

I established a link to only link SDK assemblies, and this led to a reduction in apk size to 29 MB

Here is the updated window.

enter image description here

+4
source
Sentence

@mattewrobbinsdev was just that. For future readers, here is the dialogue in Xamarin Studio:

Dialog

+1
source

All Articles