google / bundletool

Bundletool is a command-line tool to manipulate Android App Bundles
https://g.co/androidappbundle
Apache License 2.0
3.52k stars 385 forks source link

Failed build-apks by "invalid LOC header (bad signature)" #242

Closed gorry closed 3 years ago

gorry commented 3 years ago

Describe the bug Failed build-apks by "invalid LOC header (bad signature)"

Bundletool version(s) affected bundletool-all-1.8.0.jar

To Reproduce Attached log at the bottom. It may or may not occur depending on the project, and the conditions are unknown. If it does occur, be sure to reproduce it.

Known workaround Using bundletool-all-1.7.1.jar success all projects.

Environment: OS: Windows SDK Platform: 30 SDK Tools: 30.0.3 JDK: 1.8.0_92

--

java -jar bundletool-all-1.8.0.jar build-apks --bundle=foo.aab --output=foo.apks --local-testing

INFO: The APKs will be signed with the debug keystore found at 'D:\dev\android-sdk.android\debug.keystore'. [BT:1.8.0] Error: java.util.zip.ZipException: invalid LOC header (bad signature) java.io.UncheckedIOException: java.util.zip.ZipException: invalid LOC header (bad signature) at com.android.tools.build.bundletool.model.BundleModule$Builder.addEntry(BundleModule.java:357) at com.android.tools.build.bundletool.model.AppBundle.extractModules(AppBundle.java:269)

    at com.android.tools.build.bundletool.model.AppBundle.buildFromZip(AppBundle.java:75)
    at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:681)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:77)
    at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:49)

Caused by: java.util.zip.ZipException: invalid LOC header (bad signature) at java.util.zip.ZipFile.read(Native Method) at java.util.zip.ZipFile.access$1400(ZipFile.java:60) at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717) at com.google.protobuf.CodedInputStream$StreamDecoder.tryRefillBuffer(CodedInputStream.java:2785) at com.google.protobuf.CodedInputStream$StreamDecoder.isAtEnd(CodedInputStream.java:2708) at com.google.protobuf.CodedInputStream$StreamDecoder.readTag(CodedInputStream.java:2059) at com.android.aapt.Resources$XmlNode.(Resources.java:44131) at com.android.aapt.Resources$XmlNode.(Resources.java:44094) at com.android.aapt.Resources$XmlNode$1.parsePartialFrom(Resources.java:45163) at com.android.aapt.Resources$XmlNode$1.parsePartialFrom(Resources.java:45157) at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:215) at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:232) at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:237) at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:48) at com.google.protobuf.GeneratedMessageV3.parseWithIOException(GeneratedMessageV3.java:347) at com.android.aapt.Resources$XmlNode.parseFrom(Resources.java:44493) at com.android.tools.build.bundletool.model.BundleModule$SpecialModuleEntry$1.addToModule(BundleModule.java:386) at com.android.tools.build.bundletool.model.BundleModule$Builder.addEntry(BundleModule.java:355) ... 5 more

ymakhno commented 3 years ago

This error usually means that aab file is corrupted. Could you please attach a sample aab file which I can use to reproduce this or if it is not possible at least output of unzip foo.aab for aab file where this is reproducible.

gorry commented 3 years ago

Unfortunately, these projects are commercial and cannot be published at my discretion. The ones that can be published do not currently have this issue. I'm sorry. By the way, all AABs that have this problem have a file size larger than 4GB. Can this cause problems?

ymakhno commented 3 years ago

Could you try java -Dbundletool.serializer.zipflinger=false -jar bundletool-all-1.8.0.jar build-apks ...?

ymakhno commented 3 years ago

This issue is not actionable on our side, because doesn't contain example to reproduce.

If this error happens to application in production please file an issue via Play Console support team https://support.google.com/googleplay/android-developer/gethelp and we will be able to help with these commercial projects.