Firebase 应用分发:"Could not find the APK"(构建 AAB 时)

Firebase App Distribution: "Could not find the APK" (when having built an AAB)

我正在尝试将 AAB 上传到 App Distribution(链接到 Google Play),但出现此错误:

Execution failed for task ':mobile:appDistributionUploadRelease'.
> Could not find the APK. Make sure you build first by running ./gradlew assemble[Variant*** or set the artifactPath parameter to point to your APK

如何在不构建 APK 的情况下解决问题?

问题是 artifactType 默认设置为 APK,但可以将其更改为 AAB:

firebaseAppDistribution {
    artifactType = "AAB"
    ...
}

来源:documentation.