I was getting the error while I was trying to build an app bundle of a flutter app in a release mode but while I run the command flutter build appbundle, this error just showed up.
Building with sound null safety
FAILURE: Build failed with an exception.
* Where:
Build file '<PROJECT_DIR>\android\app\build.gradle' line: 36
A problem occurred evaluating project ':app'.
> No signature of method: build_djjv0udzo4jemkigdf7i4cm25.android() is applicable for argument types: (build_djjv0udzo4jemkigdf7i4cm25$_run_closure2) values: [build_djjv0udzo4jemkigdf7i4cm25$_run_closure2@736f31fd]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 2s
Running Gradle task 'bundleRelease'... 4.5s
Gradle task bundleRelease failed with exit code 1
And here is error part of android/app/build.gradle file.
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.app"
minSdkVersion XX
targetSdkVersion flutter.targetSdkVersion
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{
signingConfig signingConfigs.release
}
}
}
After trying a lot and following many articles I was not able to solve it. here are some of the similar problems which I checked.