对于另一种情况(或者可能相同),我遇到了同样的错误。
我试图通过一些更改重新打包*.aab
捆绑包。起初,我使用 zip 或 jar 来创建未签名的存档。之后,我使用jarsigner
工具对其进行了签名。我发现这*.aab
不是使用bundletool的普通 zip
> java -jar bundletool.jar validate --bundle application.aab
[BT:0.12.0] Error: The App Bundle zip file contains directory zip entry 'base/' which is not allowed.
com.android.tools.build.bundletool.model.exceptions.BundleFileTypesException$DirectoryInBundleException: The App Bundle zip file contains directory zip entry 'base/' which is not allowed.
at com.android.tools.build.bundletool.validation.BundleZipValidator.validateBundleZipEntry(BundleZipValidator.java:29)
at com.android.tools.build.bundletool.validation.ValidatorRunner.lambda$validateBundleZipFile$1(ValidatorRunner.java:47)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleZipFile(ValidatorRunner.java:46)
at com.android.tools.build.bundletool.validation.AppBundleValidator.validateFile(AppBundleValidator.java:92)
at com.android.tools.build.bundletool.commands.ValidateBundleCommand.execute(ValidateBundleCommand.java:78)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:92)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
所以我使用该实用程序创建*.aab
,然后使用jarsigner
. 您需要将base/*
子文件夹的内容压缩到单独的存档中。
> java -jar bundletool.jar build-bundle --modules base.zip --output application.aab
> jarsigner -keystore $KEYSTORE -storetype $STORETYPE -storepass $STOREPASS -digestalg SHA1 -sigalg SHA256withRSA application.zip $KEYALIAS
> java -jar bundletool.jar validate --bundle application.aab
App Bundle information
------------
Feature modules:
Feature module: base
File: assets/META-INF/AIR/application.xml
...