The build configuration for your project is defined inside build.gradle files, which are plain text files that use the syntax and options from Gradle and the Android plugin to configure the following aspects of your build:
Build variants. The build system can generate multiple APKs with different product and build configurations for the same module. This is useful when you want to build different versions of your application without having to create a separate projects or modules for each version.
Dependencies. The build system manages project dependencies and supports dependencies from your local filesystem and from remote repositories. This prevents you from having to search, download, and copy binary packages for your dependencies into your project directory.
Manifest entries. The build system enables you to specify values for some elements of the manifest file in the build variant configuration. These build values override the existing values in the manifest file. This is useful if you want to generate multiple APKs for your modules where each of the apk files has a different application name, minimum SDK version, or target SDK version. When multiple manifests are present, manifest settings are merged in priority of buildType and productFlavor, /main manifest, and the library manifests.
Signing. The build system enables you to specify signing settings in the build configuration, and it can sign your APKs during the build process.
ProGuard. The build system enables you to specify a different ProGuard rules file for each build variant. The build system can run ProGuard to obfuscate your classes during the build process.
Testing. For most templates, the build system creates a test directory, androidTest and generates a test APK from the test sources in your project, so you do not have to create a separate test project. The build system can also run your tests during the build process.
Gradle build files use Domain Specific Language (DSL) to describe and manipulate the build logic through Groovy syntax. Groovy is a dynamic language that you can use to define custom build logic and to interact with the Android-specific elements provided by the Android plugin for Gradle.