build.gradle changes

The new version of Android studio’s new project build.gradle defaults to the following:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

For example, when we need to introduce it in the project root directory, how to start? In fact, it is very simple to add it directly above the plugins.

classpath 'com.......'

Solution: Note that the buildscript needs to be placed above the plugins, otherwise an error will be reported. 

buildscript {
    dependencies {
        classpath 'com....'
    }
}

plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Guess you like

Origin blog.csdn.net/shi450561200/article/details/132819730