flutter - 您需要在 Release模式下签署您的 APK 或 Android App Bundle

标签 flutter google-play apk

我正在尝试将 flutter 应用程序上传到谷歌播放商店,但它不会让我上传 aab 文件。错误是说“您上传了一个在 Debug模式下签名的 APK 或 Android App Bundle。您需要在 Release模式下签署您的 APK 或 Android App Bundle。”我更改了我的代码,如下所示。 enter image description here

所以我将 signinConfigs 更改为发布,但得到同样的错误......

此外,其中一个教程有一个捆绑文件,其中包括一个发布文件和 aab 文件。 (https://youtu.be/zHtco9_Aw7I)。但我的文件结构如下所示。 enter image description here我不确定我做的是否正确......

另外,应该在 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/

相关文章:

java - android版本和解析错误

Flutter:Streambuilder 被多次调用

flutter - 如何在 Flutter 小部件测试中点击列表或网格的所有项目?

dart - Flutter - 在 BottomNavigationBar 中显示一个 PopupMenuButton

android - 除了使用 Google 的应用内计费之外,还有其他方法可以避免发布私有(private)信息吗?

Android Alpha,Google Play 开发者控制台上付费应用的 Beta

flutter - Riverpod 提供程序始终为空

android - Google Play 应用程序测试中的错误

android - 为 android studio 项目生成签名 APK 时,通用包装器中没有匹配的架构

android - 下载 .apk 文件后打开 android 包安装程序