您需要在发布模式下对APK或Android应用捆绑包进行签名

问题描述 投票:1回答:1

我正在尝试将flutter应用程序上传到Google Play商店,但不允许我上传aab文件。错误消息是:“您上传了在调试模式下签名的APK或Android应用程序捆绑包。您需要在发布模式下对APK或Android应用程序捆绑包进行签名。”我更改了代码,如下所示。 enter image description here

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

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

而且,应该在Google Play控制台上添加哪个文件?我使用了app.apk,但是没有用。

flutter google-play apk
1个回答
0
投票

添加

signingConfigs {
       release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
       }

到您的/android/app/build.gradle。

为此,您还应该生成一个密钥库,并在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

该附件是通过使用flutter build appbundle创建的,并且位于\build\app\outputs\bundle\release中。您应该将该捆绑包文件提交到Play商店,可以在Difference between apk (.apk) and app bundle (.aab)

上找到有关该文件的更多信息
© www.soinside.com 2019 - 2024. All rights reserved.