Error after update android studio

i have updated android studio to Giraffe | 2022.3.1 Patch 4 , I am using Flutter.
So update “distributionUrl” inside gradle-wrapper.properties to https://services.gradle.org/distributions/gradle-8.1-all.zip but get this error
A problem occurred evaluating project ‘:app’.

Failed to apply plugin ‘com.android.internal.application’.
Could not create plugin of type ‘AppPlugin’.
Could not generate a decorated class for type AppPlugin.
com/android/build/api/component/Component

how can i solve that please ?

Is the version of the android gradle plugin you use compatible with the Gradle version you update to?

I’m sorry, but I’m very weak in this section of the program. How can I be sure?

I’m not really into Android developement.
But you said you use Gradle 8.1, so theck what Android Gradle Plugin version you use and check its documentation with which Gradle version it is compatible.

Can you share a build --scan if it is able to produce one?
If not, maybe at least a --stacktrace output?