```// Project-level build.gradle plugins { id(...
# android
f
Copy code
// Project-level build.gradle
plugins {
    id("com.android.application") version "8.2.0" apply false
    id("com.android.library") version "8.2.0" apply false
}

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.4.1")
    }
}
Hello guys, by reading official doc, it's very clear to me that
com.android.application
is the AGP (Android Gradle Plugin). However I don't understand the difference with
com.android.tools.build:gradle
. Actually this one sounds more like AGP to me. There are some SO answers that say that
com.android.tools.build:gradle
is the AGP, so I'm not sure which one is AGP anymore. Thank you in advance guys 🙂
not kotlin but kotlin colored 2
should be kotlin-related because i'm using
.kts
😄
p
Both is the AGP, but you're loading an older Version of AGP (7.4.1) into the buildscript classpath while (not) applying a newer version of the AGP (8.2.0) via plugins -> id. This can cause issues, you should try to remove the buildscript section. If that causes other issues, you could try the Project Creation Wizzard to temporarily create a fresh Android project and compare the gradle files of your existing project with those that are generated by Android Studio when starting a fresh project. (Instead of using 8.2.0 you might as well upgrade to the latest 8.2.2.)
Using
plugins { id("...") }
is the "new" and preferred way of loading gradle plugins. Using
buildscript { ... }
is the "old" and deprecated way of loading gradle plugins. The different Approaches can be seen in the gradle docs https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block
thank you color 1
f
Yeah you're right. It seems that new Android projects do not include
com.android.tools.build:gradle
anymore
p
Newer projects still use
com.android.tools.build:gradle:8.2.2
etc. but automatically in the background. So you normally woudn't declare that directly but load it via the plugins block instead. That is just the path of the artifact that will be downloaded by gradle from the google maven and where both the com.android.application and com.android.library plugin are then loaded from.
🤔 1
d
#gradle
sorry 1