Gradle plugins config causes "Unknown" in modules dialog on AndroidStudio 2021

Viewed 130

I am facing a strange problem about gradle plugins config in android studio (Bumblebee).

When i added the following config in project level build.gradle:

plugins {
    id "com.android.application" version "4.2.2" apply false
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

Always appear "Unknown" in the project structure > Modules :

enter image description here

Replace with the following config everything is correct.

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

I don't know if I should use buildscript {} or plugins {} . Can anyone help me understand why this happens ?

gradle version: 6.9.2 gradle plugin version: 4.2.2

0 Answers
Related