No signature of method: build_

1,861

You're getting the error because you have a typo in your android/app/build.gradle file.

You have multiDexEnables instead of multiDexEnabled.

The line:

multiDexEnables true

should be:

multiDexEnabled true
Share:
1,861
Soufian Manai
Author by

Soufian Manai

Updated on December 31, 2022

Comments

  • Soufian Manai
    Soufian Manai over 1 year

    I've been looking all over GitHub, Stack Overflow, Reddit, Discord servers, everything. I've recently implemented firebase into a project I'm doing for a Udemy course (Flash Chat app).

    Obviously the work they're doing is outdated, so I've been looking around to find the latest versions and the lot. Though when everything is imported and should work, I get this error:

    No signature of method: build_eeszr0gcr6lj33p64zor43zf6.android() is applicable for argument types: (build_eeszr0gcr6lj33p64zor43zf6$_run_closure2) values: [build_eeszr0gcr6lj33p64zor43zf6$_run_closure2@35f07b5d]

    All of the forums I'm looking at tell me to remove experimental true somewhere, but nowhere can I find this in my build.gradle files.

    Here are the "relevant" files:

    android/app/build.gradle

    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"
    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.DaemonDev.application"
            minSdkVersion 16
            targetSdkVersion 30
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            multiDexEnables true
        }
    
        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:28.3.1')
         implementation 'com.google.firebase:firebase-auth'
        implementation 'com.google.firebase:firebase-firestore'
        implementation 'com.google.firebase:firebase-storage'
        implementation "com.android.support:multidex:$multidex_version"
    }
    

    android/build.gradle

    buildscript {
        ext.kotlin_version = '1.3.50'
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:4.1.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.10'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    gradle.properties

    org.gradle.jvmargs=-Xmx1536M
    android.useAndroidX=true
    android.enableJetifier=true
    android.enableR8=true
    android.enableDexingArtifactTransform=false
    

    local.properties

    sdk.dir=C:\\Users\\Usr\\AppData\\Local\\Android\\sdk
    flutter.sdk=C:\\flutter
    flutter.buildMode=debug
    flutter.versionName=1.0.0
    flutter.versionCode=1
    

    android/gradle/gradle-wrapper.properties

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
    

    I've imported the Firebase core, auth and cloud-firestore only.

    All the related issues have resolutions that seem not applicable. What can I try to fix this?

    • pythonNovice
      pythonNovice over 2 years
      Hey @Soufian, not too sure how to answer your question, but in case you want to see an example of a Flutter with Firebase feel free to check out my GitHub Repo github.com/dchicchon/Polus/tree/master/app
    • Soufian Manai
      Soufian Manai over 2 years
      Hey @pythonNovice I've looked, but the issue remains the same. Thanks anyways for letting me look. There were a few minor differences, but none that were of use to the issue I'm having.
    • pythonNovice
      pythonNovice over 2 years
      By any chance have you used the packages in your flutter application? Like in ‘main.dart’. I think seeing that code might help
    • Soufian Manai
      Soufian Manai over 2 years
      @pythonNovice I have only imported them, haven't used them in my application yet, as I was first still trying to get them installed and runnning the app without using the packages yet