Apply Android Gradle plugin using new syntax
I just ran into the same problem and found the solution here. The problem results from the fact that Google for whatever reasons decided to put the application plugin not into Gradle's repository of community plugins.
In build.gradle
remove the buildscript block completely and just add
plugins {
id 'com.android.application' version '3.4.0'
}
In settings.gradle
add
pluginManagement {
repositories {
gradlePluginPortal()
jcenter()
google()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "com.android.application") {
useModule("com.android.tools.build:gradle:${requested.version}")
}
}
}
}