首页 > 解决方案 > Android InvalidBundleException:没有模块的捆绑包

问题描述

我有一个用于自动化管道的 Android Bundle,我在其中使用一些 PowerShell 脚本来修改其中的一些数据。我所做的是将 i 重命名为 .zip,解压缩,然后再次压缩,然后将其重命名为 .aab。

但是当尝试在 Google Play Console 中上传或使用 bundletool 生成 apk 时,我收到以下错误:

com.android.tools.build.bundletool.model.exceptions.InvalidBundleException: Bundle without modules.
        at com.android.tools.build.bundletool.model.exceptions.UserExceptionBuilder.build(UserExceptionBuilder.java:58)
        at com.android.tools.build.bundletool.validation.BundleValidationUtils.lambda$isAssetOnlyBundle$0(BundleValidationUtils.java:74)
        at java.util.Optional.orElseThrow(Unknown Source)
        at com.android.tools.build.bundletool.validation.BundleValidationUtils.isAssetOnlyBundle(BundleValidationUtils.java:72)
        at com.android.tools.build.bundletool.validation.ModuleNamesValidator.validateAllModules(ModuleNamesValidator.java:90)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModulesUsingSubValidator(ValidatorRunner.java:75)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleUsingSubValidator(ValidatorRunner.java:69)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.lambda$validateBundle$3(ValidatorRunner.java:58)
        at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundle(ValidatorRunner.java:58)
        at com.android.tools.build.bundletool.validation.AppBundleValidator.validate(AppBundleValidator.java:106)
        at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:678)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:77)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:49) 

我正在使用[System.IO.Compression.ZipFile]::ExtractToDirectory和解[System.IO.Compression.ZipFile]::CreateFromDirectory压缩/压缩。我不能使用 Commpress-Archive/Expand-Archive,因为它需要更高的 PowerShell 版本。

在解压缩之前,捆绑包工作正常。知道为什么解压缩/压缩会破坏捆绑包吗?

先感谢您!

标签: androidpowershellgoogle-playandroid-bundle

解决方案


推荐阅读