Where is the documentation for build.gradle's `android` block?

Viewed 152

In a build.gradle, we have the android block. From my limited understanding of Android Gradle Plugin (and Groovy/ Kotlin), this is a method/ (or function?) called android which accepts 1 argument, a closure.

android {
    compileSdkVersion(AppConfig.compileSdkVersion)
    buildToolsVersion(AppConfig.buildToolsVersion)
}

I was not able to find any documentation about android, both on the Google Developer website and Gradle.org. It doesn't help that the function has the same name as the whole operating system. Any documentation about Android Gradle plugin would be helpful, as it seems like information about it is pepperred all over Android docs. So far, I can search what each property means (e.g. applicationId, testInstrumentationRunner), but I want to see all the properties which android has, which is where the documentation comes in handy.

What sparked all these questions was this "Introduction to Groovy and Gradle"

I was able to get the "package name" (maybe) for the android method with autocomplete in Android Studio: com.android.build.gradle.internal.dsl.BaseAppModule, but cannot find source code or documentation...

2 Answers

Please note that the android keyword mentioned in your question is not a function / method.

The android { } is an android block is where you configure all your Android-specific build options.

Also, as of now there is no specific document dedicated to this block.
However, just to assist you, I have identified following attributes which can be placed inside this block.

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
    
    }

    buildTypes {
        
    }
    compileOptions {
        
    }
    kotlinOptions {
       
    }
    packagingOptions {
        
    }

}

Related