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.
The 'useProguard' line has ben removed, as of Gradle 7.0.0. Flutter should obfuscate without this, but you can add shrinkResources true
, if you want.
Android R8 is an alternative to using Proguard, with its own settings; as long as you're configuring this, you might want to look into switching.