I'm currently trying to upload my Flutter app to the Play Store. I followed the instruction on the Flutter documentation. But when I run the command "flutter build appbundle", I get the following error:
A problem occurred evaluating project ':app'. No signature of method: build_bobankfptw27tkl4q05osmwsd.android() is applicable for argument types: (build_bobankfptw27tkl4q05osmwsd$_run_closure2) values: [build_bobankfptw27tkl4q05osmwsd$_run_closure2@103337d8]
Here is the content of my build.gradle file.
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "fr.mediprest"
minSdkVersion 18
targetSdkVersion 30
compileSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
applicationId "fr.mediprest"
minSdkVersion 18
targetSdkVersion 30
compileSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Does someone has any idea of what may cause this error?