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.
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
com/android/build/gradle/internal/pipeline/VariantInfoImpl.(Lcom/android/build/gradle/internal/scope/VariantScope;)V @200: goto
Error exists in the 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:
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?