the Android Gradle plugin might get updated when you update android studio so it might be not compatible with your kotlin version.
take a look at kotlin multiplatform compatibility guide
and try to downgrade the agp version to the old one or upgrade the kotlin version maybe.
take a look also at this it might be helpful Unable to find method ''java.io.File > org.jetbrains.kotlin.gradle.tasks.KotlinCompile.getDestinationDir()