Problem with flutter in app/build.gradle

Hello please help me with this I’m desperate…
Gradle error …

Launching lib/main.dart on AOSP on IA Emulator in debug mode...

Running Gradle task ‘assembleDebug’…

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/mac/Desktop/flutter2-master/android/app/build.gradle’ line: 48

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

Could not find method shrinkResources() for arguments [true] on DefaultConfig_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=16, mCodename=‘null’}, targetSdkVersion=DefaultApiVersion{mApiLevel=28, mCodename=‘null’}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=1, versionName=1.0.0, applicationId=com.lifeonapp.flutter2, testApplicationId=null, testInstrumentationRunner=androidx.test.runner.AndroidJUnitRunner, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=, mConsumerProguardFiles=, mManifestPlaceholders={}, mWearAppUnbundled=null} of type

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

  • Get more help at

Exception: Gradle task assembleDebug failed with exit code 1

also i have a problem in this part…

it says flutter Sdk not found but i have flutter running a moment ago and emulating even widget appear and i have the flutter support.

everything went wrong when i try to add cached_network_image 2.2.0+1 to pubspec.yaml i added it and then erased it to see if the error was gone and could fix it instead it damaged all my files in the android file at least in gradle.