Closed entdark closed 1 year ago
I don't think that this is a LibZipSharp bug; I think that .jar
is corrupt:
% unzip D2648AD79002B2B3.jar.zip
% jar tf D2648AD79002B2B3.jar
java.util.zip.ZipException: invalid END header (bad central directory offset)
at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1519)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:248)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:148)
at jdk.jartool/sun.tools.jar.Main.list(Main.java:1499)
at jdk.jartool/sun.tools.jar.Main.run(Main.java:380)
at jdk.jartool/sun.tools.jar.Main.main(Main.java:1680)
If I use unzip -l
:
% unzip -l D2648AD79002B2B3.jar
Archive: D2648AD79002B2B3.jar
error [D2648AD79002B2B3.jar]: missing 1 bytes in zipfile
(attempting to process anyway)
Length Date Time Name
--------- ---------- ----- ----
2643 01-01-1981 01:01 com/devtodev/google/AdvertisingData$ExceptionData.class
3064 01-01-1981 01:01 com/devtodev/google/AdvertisingData$GoogleAdvertisingId.class
1193 01-01-1981 01:01 com/devtodev/google/AdvertisingData.class
2342 01-01-1981 01:01 com/devtodev/google/GoogleAdvertising.class
24 01-01-1981 01:01 META-INF/DTDGoogle_productionAndroidRelease.kotlin_module
--------- -------
9266 5 files
I don't know how or why this file is "missing 1 bytes", but it is a corrupt/invalid ZIP file.
Where did you get D2648AD79002B2B3.jar
from? It looks like the classes.jar
from the android-google 1.0 maven package, but with a 1 byte file size difference: 5629 bytes for android-google.aar!classes.jar
vs. 5628 bytes for D2648AD79002B2B3.jar
. I don't know how or why that would happen.
File D2648AD79002B2B3.jar
got automatically created in the obj/Debug/net7.0-android/lp/165/jl/libs/D2648AD79002B2B3.jar
path. The obj
folder is next to Android project.
Summary of discussion on Discord:
the issue was in a corrupt .jar
file that was in our binding library. The corruption happened because we had .gitattributes
that replaces line endings and we did not have a rule to ignore .jar
files. So git
"corrupted" the file.
The issue has nothing to do with LibZipSharp or Xamarin.Android/.NET7 Android.
Closing.
Environment: VS for Mac 17.5.4 (build 8)
.NET7 Android application
Partial build log before the issue:
The issue started happening after I added a binding library compiled against
net7-android
.When the application project and the binding library projects targeted
monodroid11.0
it was fine.The problematic autogenerated file:
D2648AD79002B2B3.jar.zip
The problematic binding library:
Xamarin.DevToDev.Analytics.Android.zip