Open siddharthashw opened 6 years ago
Same here
I found a solution, while iterating through the elements of the ZIP, instead of getting the stream in current way then do this for iterate:
foreach (ZipEntry entry in zip)
And this to access the stream:
zipInput.GetInputStream(entry);
I think while iterating through stream this is failing as Android v2 signature scheme is adding "APK Signing Block" just before of "Central Directory" part of the zip. And I think zip library can't manage this.
In fact, don't try to modify the original zip file and create a new copy of it. As the "Central Directory" management gets crazy and few files are lost.
I hope this would help someone.
Worked for me as well, thx.
For anyone interested, here's a snippet of code that fixed my issue (thanks @forlayo for the solution)
foreach(ICSharpCode.SharpZipLib.Zip.ZipEntry entry in zipfile)
{
if(entry != null)
{
if(entry.Name.ToLower() == "androidmanifest.xml")
{
manifestData = new byte[50 * 1024];
Stream strm = zipfile.GetInputStream(entry);
strm.Read(manifestData, 0, manifestData.Length);
}
if(entry.Name.ToLower() == "resources.arsc")
{
Stream strm = zipfile.GetInputStream(entry);
using (BinaryReader s = new BinaryReader(strm))
{
resourcesData = s.ReadBytes((int)entry.Size);
}
}
}
}
If the APK package name contains Chinese, the program will become very slow.
good ! Although it can handle reads without errors, it is not successful when parsing xml
manifestXml = manifest.ReadManifestFileIntoXml(manifest_xml);
good,Worked for me as well, thx.
I have just follow this page.
And while at run-time, I am getting this error. Wrong Local header signature: 0xFF8
My basic aim is to read basic information(like version, logo, name) of .apk file.
Need help ASAP