Recently, i upgraded the dependencies of my Flutter project and migrated project to Material Design 3. Everything went well util i tried to release a new version. Some dependencies require Gradle 7+, so i just upgraded Gradle version, but this caused the following error:
Ambiguous method overloading for method
com.android.build.gradle.internal.dsl.ProdctFlavor$AgpDecorated_Decorated#signingConfig.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between
previous build.gradle
buildTypes {
release {
signingConfig signingConfigs.release
}
}
flavorDimensions "deploy"
productFlavors {
github {
dimension "deploy"
signingConfig signingConfigs.release
}
fdroid {
dimension "deploy"
signingConfig null
}
}
There's no double that some changes happened in Gradle 7 and signingConfig null
is not supported anymore. Since signingConfig
can't be null, we can set it to an empty instance.
build.gradle
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
}
}
flavorDimensions "deploy"
productFlavors {
github {
dimension "deploy"
signingConfig signingConfigs.release
}
fdroid {
dimension "deploy"
signingConfig signingConfigs.debug
}
}
We added a debug
object into buildTypes
paramters and replaced signingConfig null
with signingConfig signingConfigs.debug
. This change allow project to build the apk without sign and without erros.