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

  • please provide the code inside build.gradle so we can see what you're doing wrong – Texv Mar 31 '23 at 06:41
  • please see know i added image of code –  Mar 31 '23 at 06: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 https://stackoverflow.com/questions/37250493/could-not-find-method-android-for-arguments – GrahamD Mar 31 '23 at 07:55

1 Answers1

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"
            )
        }
    }
}
Texv
  • 1,225
  • 10
  • 14