No signature of method: build_2otgwqsb26ll3ozfhq28...
# general
s
No signature of method: build_2otgwqsb26ll3ozfhq28ekhi5.android() is applicable for argument types: (build_2otgwqsb26ll3ozfhq28ekhi5$_run_closure2) values: [build_2otgwqsb26ll3ozfhq28ekhi5$_run_closure2@72b4586d] im getting this error what may be the issue. attached is my build.gradle(app)
Copy code
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 FileNotFoundException("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"

android {
    compileSdkVersion 32

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    androidExtensions{
        experimental = true
    }
    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.code_with_patel"
        minSdkVersion 19
        targetSdkVersion 32
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    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
            minifyEnabled true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
v
It means you have "some" error within your
android { ... }
closure. Unfortunately the Groovy DSL does not show a better error message. That's one of the reasons I greatly prefer the Kotlin DSL. There you have amazing IDE support and type-safe build scripts with proper error messages. In Groovy DSL the best I know to investigate in your case is either to see the error or to comment out everything and comment in line by line or block by block to find the culprit.
s
it says on line 28 so could the culprit be after or just anywhere?
v
Line 28 is where your
android { ... }
closure starts. The problem is within that closure
l
FYI we found a bug on the Gradle side that did not help the reporting, it will be fixed in Gradle 7.5
❤️ 1
a
Hey! Just wanted to make sure you are aware of a #flutter specific channel. It is new but this way we can focus flutter issues.
168 Views