hylander0 / Iteedee.ApkReader

.NET library written in C# for reading/parsing APK manifest (AndroidManifest.xml) and resource data (Resources.arsc)
97 stars 42 forks source link

Wrong Local header signature: 0xFF8 #20

Open siddharthashw opened 6 years ago

siddharthashw commented 6 years ago

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

forlayo commented 5 years ago

Same here

forlayo commented 5 years ago

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.

GabeBigBoxVR commented 5 years ago

Worked for me as well, thx.

FransHk commented 4 years ago

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);
                                    }
                                }
                            }
                        }
GoodTimeGGB commented 2 years ago

If the APK package name contains Chinese, the program will become very slow.

wz172 commented 1 year ago

good ! Although it can handle reads without errors, it is not successful when parsing xml

manifestXml = manifest.ReadManifestFileIntoXml(manifest_xml);

OneFreeCoder commented 3 weeks ago

good,Worked for me as well, thx.