我按照 official flutter page. 中的说明一步一步创建了一个 key 和 keystore 并签署了我的 apk。
但是当我尝试将它上传到 Google Play 管理中心时,出现了这个错误:
"You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode"
A similar question之前有人问过,但没有解决我的问题。
这是我的 app/build.gradle 的相关部分:
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "my.package.name"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
这是我的 Android Studio 版本的屏幕截图(Android SDK 为红色与此无关。):
我的 output.json 文件:
[
{
"outputType": {
"type": "APK"
},
"apkInfo": {
"type": "MAIN",
"splits": [
],
"versionCode": 1,
"versionName": "1.0.0",
"enabled": true,
"outputFile": "app-release.apk",
"fullName": "release",
"baseName": "release"
},
"path": "app-release.apk",
"properties": {
}
}
]
最佳答案
似乎没有任何建议有效。然后,一个
flutter clean
所有问题都解决了。我可以通过 Android Studio 或命令行创建一个 apk。感谢 VikaS 和 Harsha pulikollu
关于android - Google Play 控制台不接受 Flutter 发布的 apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54850298/