How can I apply Android plugin using new Gradle plugin syntax:
plugins {
id "..." version "..."
}
Instead of:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
apply plugin: 'com.android.application'
To add a Gradle plugin with dependencies, you can use code similar to the following: Plugin DSL GA versions. Plugin DSL non GA versions. Legacy Plugin Application.
Select Tools | Kotlin | Configure Kotlin Plugin Updates. In the Update channel list, select the Early Access Preview channel. Click Check again. The latest EAP build version appears.
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}")
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With