我已经用android studio在flutter中构建了一个应用程序,并试图在play store上发布。
根据https://flutter.dev/docs/deployment/android#reviewing-the-build-configuration,“运行flutter build appbundle
(运行flutter构建默认为发布构建。)”x1c 0d1xx 1c 1d 1x
然而,当我尝试在Play控制台上上传此文件时,我收到错误消息“您上传了一个在调试模式下签名的APK或Android应用程序捆绑包。您需要在发布模式下签名您的APK或Android应用程序捆绑包。”
我应该做些什么不同的事情?
从我的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
}
}
}
字符串
5条答案
按热度按时间gpfsuwkq1#
Flutter可以选择构建
appbundle
:字符串
我的参考来自这个github project。
yhuiod9q2#
尝试修改buildTypes块。
字符串
zbsbpyhn3#
请确保在“Android/key.properties“中正确设置并引用了密钥库文件。
然后运行
flutter clean && flutter build appbundle --release
如果您得到相同的错误,请尝试以下有用的演练:https://medium.com/@psyanite/how-to-sign-and-release-your-flutter-app-ed5e9531c2ac
jei2mxaa4#
你在signingConfigs前面有调试,只需将其更改为release
字符串
tjjdgumg5#
在'android/app/build.gradle'中添加您的buildTypes块
字符串
运行
flutter clean
flutter pub get
然后flutter build appbundle --release