我正在尝试将 flutter 应用程序上传到谷歌播放商店,但它不会让我上传 aab 文件。错误是说“您上传了一个在 Debug模式下签名的 APK 或 Android App Bundle。您需要在 Release模式下签署您的 APK 或 Android App Bundle。”我更改了我的代码,如下所示。
所以我将 signinConfigs 更改为发布,但得到同样的错误......
此外,其中一个教程有一个捆绑文件,其中包括一个发布文件和 aab 文件。 (https://youtu.be/zHtco9_Aw7I)。但我的文件结构如下所示。 我不确定我做的是否正确......
另外,应该在 google play 控制台上添加哪个文件?我使用了 app.apk 但没有用。
最佳答案
添加
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
到你的/android/app/build.gradle。
为此,您还应该在之前生成一个 keystore 并在 build.gradle 文件中引用它,例如:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
您还应该阅读以下文档:https://flutter.dev/docs/deployment/android .
appbundle 是使用
flutter build appbundle
创建的。 , 它位于 \build\app\outputs\bundle\release
.您应该将该捆绑文件提交到 Play 商店,您可以在 Difference between apk (.apk) and app bundle (.aab) 上阅读更多信息。
关于flutter - 您需要在 Release模式下签署您的 APK 或 Android App Bundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62279404/