have you updated the gradle version as well as the com.android.application version?
if not, this should allow you to do so:
go to android/settings.gradle and change this line to a more recent version:
id("com.android.application") version "8.7.0" apply false
then go to android/gradle/wrapper/gradle-wrapper.properties and change the version of this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
the lines I provide are already up to date for the new versions of flutter.