'Flutter: Using Proguard with Gradle 7.0.4

I just updated to Gradle 7.0.4 and upon build I now get the error.

A problem occurred evaluating project ':app'.
No signature of method: build_9gq7rvxos4tcg7upa17qqy1oj.android() is applicable for argument types: (build_9gq7rvxos4tcg7upa17qqy1oj$_run_closure3) values: [build_9gq7rvxos4tcg7upa17qqy1oj$_run_closure3@558fca1c]

As the error pointed to the android{} tag in my app/build.gradle I tried commenting out different sections of the android{} tag. I managed to get rid of the error by commenting out Proguard:

android {

   /* More code */  

   buildTypes {
        release {
            signingConfig signingConfigs.release

            // These lines seem to have caused the error:
            // minifyEnabled true
            // useProguard true
            // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
   }
}

However, I would still like to use proguard so my question is what I have to change in my code to make this happen.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source