nic*_*ckt 30 android google-play android-studio flutter
我已经使用 android studio 在 flutter 中构建了一个应用程序,并尝试在 Play 商店上发布它。
根据https://flutter.dev/docs/deployment/android#reviewing-the-build-configuration,“运行flutter build appbundle(运行 flutter 构建默认为发布版本。)”

但是,当我尝试在 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
}
}
}
Run Code Online (Sandbox Code Playgroud)
小智 24
Flutter 可以选择构建appbundle:
flutter build appbundle
Run Code Online (Sandbox Code Playgroud)
我的参考来自这个github项目。
小智 18
尝试修改您的 buildTypes 块。
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Run Code Online (Sandbox Code Playgroud)
Mik*_*ubs 14
确保您的密钥库文件已正确设置并在“Android/key.properties”中引用。这是创建密钥库的命令:
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
然后运行flutter clean && flutter build appbundle --release
如果您遇到同样的错误,请尝试以下有用的演练:https://medium.com/@psyanite/how-to-sign-and-release-your-flutter-app-ed5e9531c2ac
| 归档时间: |
|
| 查看次数: |
63467 次 |
| 最近记录: |