您已在调试模式下发送已签名的 APK 或 Android App Bundle。在发布模式下签名。如何修复它(颤振)

You have sent a signed APK or Android App Bundle in debug mode. Sign it in release mode. How to fix it (flutter)

我必须生成一个 APK 才能在 Google Play 商店中发布应用程序,所以我执行了以下步骤:

storePassword=myPass
keyPassword=myPass
keyAlias=KEY
storeFile=/app/key.jks
def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now,
            // so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }

但是当我将 apk 发送到 google play publish 时,我收到了这条消息:

You have sent a signed APK or Android App Bundle in debug mode. Sign it in release mode

我需要做什么?

删除重复项buildType release

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now,
            // so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }

或重命名为debug

buildTypes {
    release {
        signingConfig signingConfigs.release
    }
    debug {
        signingConfig signingConfigs.debug
    }
}