您需要在发布模式下签署APK或Android应用程序捆绑包

时间:2020-06-09 09:34:24

标签: flutter google-play apk

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

所以我将signinConfigs更改为release,但是得到了相同的错误...

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

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

1 个答案:

答案 0 :(得分:1)

添加

Imports System.Drawing.Imaging

Public Class Form1
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim ofd As New OpenFileDialog()
        If ofd.ShowDialog() = DialogResult.OK Then
            Dim bmp As New Bitmap(ofd.FileName)
            PictureBox.Image = bmp
            Dim width As Integer = bmp.Width
            Dim height As Integer = bmp.Height
            Dim bmr As New Bitmap(height, height)
            For i = 0 To width - 1
                For j = 0 To height - 1
                    Dim a,b,c As Integer
                    Dim color As New Color
                    color = bmp.GetPixel(i, j)
                    a = color.a / 2
                    b = color.b  / 2
                    c = color.c / 2

                    bmr.SetPixel(i, j, Color.FromArgb(a,b,c ))
                    a = 0 : b = 0 : c = 0
                Next
            Next
            PictureBox2.Image = bmr
            bmr.Save("image2.jpg", Imaging.ImageFormat.Jpeg)
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog()
        Dim imgSource As String
        If ofd.ShowDialog() = DialogResult.OK Then
            imgSource = ofd.FileName
            Dim bmp As New Bitmap(ofd.FileName)
            PictureBox.Image = bmp
            Dim wid As Integer = ((bmp.Width / 2) + 1)
            Dim hgt As Integer = ((bmp.Height / 2) + 1)
            Dim bmr As New Bitmap(wid, hgt)
            For i = 0 To wid - 2
                For j = 0 To hgt - 2
                    Dim a,b,c  As Integer
                    For x = 0 To 1
                        For y = 0 To 1
                            Dim cc As New Color
                            cc = bmp.GetPixel(i * 2 + x, j * 2 + y)
                            a += cc.a
                            b += cc.b
                            c += cc.c
                        Next
                    Next
                    a = a / 4
                    b = b / 4
                    c = c / 4
                    bmr.SetPixel(i, j, Color.FromArgb(a,b,c ))
                    a = 0 : b = 0 : c = 0
                Next
            Next
            PictureBox1.Image = bmr
            bmr.Save("test.jpg", Imaging.ImageFormat.Jpeg)
        End If
    End Sub
End Class

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

为此,您还应该生成一个密钥库,并在build.gradle文件中对其进行引用,例如:

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

您还应该在以下位置阅读文档:https://flutter.dev/docs/deployment/android

使用def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } 创建应用程序,它位于flutter build appbundle中。您应该将该捆绑包文件提交到Play商店,您可以在Difference between apk (.apk) and app bundle (.aab)

上找到有关该文件的更多信息。