AndroidFlutterGradle

MissingMethodException: No signature of method

When running a Flutter app, I faced this issue Caused by: groovy.lang.MissingMethodException: No signature of method

Build file 'D:\flutter_sdk_3.3.2\.pub-cache\hosted\pub.dartlang.org\flutter_keyboard_visibility-5.4.3\android\build.gradle' line: 24

A problem occurred evaluating project ':flutter_keyboard_visibility'.
> No signature of method: build_3tbi0w4ks8a0qk2logy5avcmc.android() is applicable for argument types: (build_3tbi0w4ks8a0qk2logy5avcmc$_run_closure2) values: [build_3tbi0w4ks8a0qk2logy5avcmc$_run_closure2@248ebb21]

I see above error message is not clear to where exactly issue causing the issue. Issue happening in build.gradle

group 'com.jrai.flutter_keyboard_visibility'
version '1.0'

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

apply plugin: 'com.android.library'

android {
    // Conditional for compatibility with AGP <4.2.
    if (project.android.hasProperty("namespace")) {
        namespace 'com.jrai.flutter_keyboard_visibility'
    }

    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 16
    }

    lint {
        disable 'InvalidPackage'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

To resolve the issue, you need to remove the lint code. after removing those lines Im able build app. below is the build.gradle file after removing lint code

group 'com.jrai.flutter_keyboard_visibility'
version '1.0'

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

apply plugin: 'com.android.library'

android {
    // Conditional for compatibility with AGP <4.2.
    if (project.android.hasProperty("namespace")) {
        namespace 'com.jrai.flutter_keyboard_visibility'
    }

    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 16
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Hope it helps ๐Ÿ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *