A problem occurred evaluating project ‘:app’. build gradle problem

Solution for A problem occurred evaluating project ‘:app’. build gradle problem
is Given Below:

I tried to run my first firebase application but it didn’t work because of this error :

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:UsersborasOneDriveMasaustuSoftwareProgramlamaTemelliYazilimFlutterfirebase_applicationfirebase_applicationandroidappbuild.gradle’ line: 29
  • What went wrong:
    A problem occurred evaluating project ‘:app’.

No signature of method: build_884xt67ny8crpgv70jgbem96p.android() is applicable for argument types: (build_884xt67ny8crpgv70jgbem96p$_run_closure2) values: [build_884xt67ny8crpgv70jgbem96p$ure2) values: [[email protected]]

  • 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.
  • Get more help at https://help.gradle.org

And this is what i android/app/build.gradle looks like :

def localProperties = new Properties()
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"
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 30

    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.firebase_application"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
        classpath 'com.android.tools.build:gradle:4.2.0'

    }

    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
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation platform('com.google.firebase:firebase-bom:26.3.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-messaging'

    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    compile 'com.android.support:multidex:2.0.1'
    implementation platform('com.google.firebase:firebase-bom:28.3.0')
    classpath 'com.google.gms:google-services:4.2.0'
}

Try to change your below virsions :

compileSdkVersion 28

minSdkVersion 21

targetSdkVersion 30