A Bit late here but for those who are using newer version of Android Studio, as of today here I am writing this answer who uses multiple Android studios on one machine, one is installed in default directory, other is just a zipped downloaded to same directory but different parent folder.
Due to this stunt of mine, I also faced this issue precisely to be
** Plugin [id: 'com.android.application', version: '8.7', apply: false] was not found in any of the following sources: **
So the solution for those who use Gradle whether older or newer version, is check the AGP version matches the supported version of gradle that you are using. It must be the minimum supported gradle version. here is link. navigate to it and match the gradle versions, if it is not listed here, then use a AGP version lower than your gradle.
e.g. this is Gradle wrapper file
https://developer.android.com/build/releases/gradle-plugin#kts
distribution URL is https://services.gradle.org/distributions/gradle-8.10-all.zip
AGP is "8.7.0"