How to find out properties in applicationVariants of android gradle plugin?

I am using Android Studio with the Gradle plugin for application development. I learned how to use the Android Gradle plugin on the DSL Reference . But one thing I discovered is that some of the application options on the doc are hard to understand. It only gives such a description:

DomainObjectSet <ApplicationVariant> applicationVariants

List of application options. Because collections are created after evaluation, they should be used with Gradle all iterator to handle future items.

But what are the properties in ApplicationVariant? I dont know. And I did not find anything link to describe ApplicationVariant.

Only in the Gradle Plugin user guide at the bottom of the page. It documents the available properties in applicationVariants, libraryVariants, and testVariants. But I found that some of these properties have long been outdated, and Android has not updated this page.

So where can I find the most updated properties in ApplicationVariant?

+6
source share
2 answers

https://android.googlesource.com/platform/tools/build/+/8dca86a/gradle/src/main/groovy/com/android/build/gradle/internal/ApplicationVariant.groovy

. : , , versionName, applicationId ..

public interface ApplicationVariant {
    String getName()
    String getDescription()
    String getDirName()
    String getBaseName()
    VariantConfiguration getConfig()
    boolean getZipAlign()
    boolean isSigned()
    boolean getRunProguard()
    FileCollection getRuntimeClasspath()
    FileCollection getResourcePackage()
    Compile getCompileTask()
    List<String> getRunCommand()
    String getPackage()
    AndroidBuilder createBuilder(AndroidBasePlugin androidBasePlugin)
}

:

def filtered = ['class', 'active']

println theObject.properties
            .sort{it.key}
            .collect{it}
            .findAll{!filtered.contains(it.key)}
            .join('\n')
+13

All Articles