Android Studio 4.1.1 fails to compile Flutter programs

I have installed the latest Android Studio onto a new machine, and have installed Flutter plugin into the new installation. I then created a Flutter project, taking all the default settings.

After creating the project, I set up an emulator and tried to compile and run the flutter app. Unfortunately I get the following error:

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\rbrown3\AndroidStudioProjects\flutter_app\android\build.gradle’ line: 26

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

A problem occurred configuring project ‘:app’.
Failed to notify project evaluation listener.
Uninitialized object exists on backward branch 142
Exception Details:
Location:
com/android/build/gradle/internal/pipeline/VariantInfoImpl.(Lcom/android/build/gradle/internal/scope/VariantScope;)V @200: goto
Reason:
Error exists in the bytecode
Bytecode:

      ...bytecode listing omitted for brevity...

Note that I also took a look at the build.gradle file that contained the offending line . Line 26 just contains:

project.evaluationDependsOn(':app')

I did not edit that line at all. In fact, I did not change anything, not even in the main.dart file.

Have I found a bug in the Flutter plugin? Or is it an Android Studio bug? Why does a pristine installation of Android Studio fail to compile default code due to a flaw in a gradle build file??? More importantly, what is the flaw causing these compilation failures and how do I fix it?

1.first check this file

My grade.properties:

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

2.and check emulator version and targeted and minsdk version

2.And build again and run it