3

When running the flutter build appbundle command this error is shown:

enter image description here

  • Where: Build file 'C:\Projetos\Vai para o GitHub\devstravel\android\app\build.gradle' line: 38

    • What went wrong: A problem occurred evaluating project ':app'.

    No signature of method: build_3p7kb4yalue4j0dkob18nu1yo.android() is applicable for argument types: (build_3p7kb4yalue4j0dkob18nu1yo$_run_closure2) values: [build_3p7kb4yalue4j0dkob18nu1yo$_run_closure2@2d50add8]

    • 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.


I don't understand why this is wrong, I'm uploading my 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 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"


def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')

if (keystorePropertiesFile.exists()){
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}



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.junior.devstravel"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs{
        release{
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties ['keyPassword']
            storeFile keystoreProperties ['storeFile'] ? file(keystoreProperties['storeFile']) : null
            sotePassword keystoreProperties ['storePassword']
        }
    }

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

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
  • Usually if your app was running fine before this error, check what new changes you must have made and comment out line by line the new changes and test to see if it builds. Hopefully this should work, but post the full build.gradle file including a pointer to where the file error start is. – Leo Sammy May 13 '22 at 22:14
  • I also had the same problem. I solved it by disabling proguard. Refer to the following document. https://github.com/flutter/flutter/issues/92974 – battlecook May 22 '22 at 14:41
  • Just comment out useProguard, my answer here : https://stackoverflow.com/questions/66292426/how-do-you-fix-the-following-error-a-problem-occurred-evaluating-project-app/74282362#74282362 – Xakiru Nov 01 '22 at 22:16

1 Answers1

1

The solution to the problem was very simple! I mistyped storePassword

signingConfigs{
    release{
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties ['keyPassword']
        storeFile keystoreProperties ['storeFile'] ? file(keystoreProperties['storeFile']) : null
        **sotePassword** keystoreProperties ['storePassword']
    }
}