首页 > 解决方案 > 在发布模式下颤振构建 appbundle

问题描述

我已经使用 android studio 在颤振中构建了一个应用程序,并试图在 Play 商店中发布它。

根据https://flutter.dev/docs/deployment/android#reviewing-the-build-configuration,“运行flutter build appbundle(运行颤振构建默认为发布构建。)” 在此处输入图像描述 在此处输入图像描述

但是,当我尝试在播放控制台上上传此内容时,我收到错误消息“您上传了一个在调试模式下签名的 APK 或 Android App Bundle。您需要在发布模式下签署您的 APK 或 Android App Bundle。” 在此处输入图像描述

我应该怎么做?

从我的 gradle.build :


def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.rtterror.custom_snooze_alarm"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

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

    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
        }
    }
}

标签: androidandroid-studiofluttergoogle-play

解决方案


Flutter 可以选择构建一个appbundle

flutter build appbundle

我的参考来自这个github 项目


推荐阅读