0

enter image description hereFAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\ADMIN\StudioProjects\escollege\android\build.gradle' line: 33

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

Could not find method android() for arguments [build_mpoqbmpayrcutgh3yb1zx28e$_run_closure5@210561ae] on root project 'android' of type org.gradle.api.Project.

it says build failed error in line 33 of build.gradle file. i don't know how to solve this

enter image description here

3
  • please provide the code inside build.gradle so we can see what you're doing wrong Commented Mar 31, 2023 at 6:41
  • please see know i added image of code Commented Mar 31, 2023 at 6:57
  • The android block of code is in the wrong build.gradke file. It should be in the build.gradle in the ...\android\app folder. See stackoverflow.com/questions/37250493/… Commented Mar 31, 2023 at 7:55

1 Answer 1

1

You placed the 'android' code in the wrong file. There are two build.gradle files, one is outside the 'app' folder and one inside. You need to put it in the one that is inside the 'app'folder.

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    

    buildTypes {
        release {
            ifMinifyEnabled true
            isShrinkResources true
            proguardFiles(
                    getDefaultProguardFile("proguard-android-optimize.txt"),
                    "proguard-rules.pro"
            )
        }
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.