Interface AndroidProject
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final StringUsed to ask AGP to avoid task registration (if possible) during sync, in order to improve sync performance.static final StringDeprecated.Only has effect in AGP 3.5.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionReturns the aapt options.Returns the namespace of the AndroidTest artifact.intReturns the model api version.Returns the boot classpath matching the compile target.Returns the build folder of this project.Returns the build tools version used by this module.Returns a list of all theBuildTypein their container.Returns the compilation target as a string.Returns theProductFlavorContainerfor the 'main' default config.Returns the name of the variant the IDE should use when opening the project for the first time.com.android.builder.model.DependenciesInfoReturns the list of dynamic features.Returns a list of extra artifacts meta data.getFlags()Returns the AGP flags for this project.Returns a list of all the flavor dimensions, may be empty.Returns a list of folders or jar files that contains the framework source code.Returns the optional group-id of the artifact represented by this project.Returns the compile options for Java code.com.android.builder.model.LintOptionsReturns the lint options.Returns the lint jars that this module uses to run extra lint checksReturns the model version.getName()Returns the name of the module.Returns the namespace of the main artifact.Returns the collection of toolchains used to create any native libraries.Returns the NDK version used by this module.intReturns the generation of the plugin.Returns a list of all theProductFlavorin their container.intReturns the type of project: Android application, library, feature, instantApp.Returns the resource prefix to use, if any.Collection<com.android.builder.model.SigningConfig>Returns a list ofSigningConfig.Collection<com.android.builder.model.SyncIssue>Deprecated.requestProjectSyncIssuesinstead.Deprecated.usegetSyncIssues()Returns a list of all the variant names.Returns a list of all the variants.Collection<com.android.builder.model.VariantBuildInformation>Returns the minimal information of variants for this project, excluding test related variants.Returns the options for view binding.booleanReturns true if this is the base feature split.booleanDeprecated.usegetProjectType()instead.
-
Field Details
-
PROPERTY_BUILD_MODEL_ONLY
- See Also:
-
PROPERTY_BUILD_MODEL_ONLY_ADVANCED
- See Also:
-
PROPERTY_BUILD_MODEL_ONLY_VERSIONED
- See Also:
-
PROPERTY_BUILD_MODEL_FEATURE_FULL_DEPENDENCIES
- See Also:
-
PROPERTY_BUILD_MODEL_DISABLE_SRC_DOWNLOAD
Deprecated.Only has effect in AGP 3.5. Android Studio 3.6 onwards downloads sources using an injected gradle tooling model and model builder.Was a property to disable source download during model sync, which is no longer done by AGP.- See Also:
-
PROPERTY_ANDROID_SUPPORT_VERSION
- See Also:
-
PROPERTY_ANDROID_STUDIO_VERSION
- See Also:
-
PROPERTY_GENERATE_SOURCES_ONLY
- See Also:
-
PROPERTY_AVOID_TASK_REGISTRATION
Used to ask AGP to avoid task registration (if possible) during sync, in order to improve sync performance. See http://b/303832930 for details.- See Also:
-
ARTIFACT_MAIN
- See Also:
-
ARTIFACT_ANDROID_TEST
- See Also:
-
ARTIFACT_UNIT_TEST
- See Also:
-
ARTIFACT_TEST_FIXTURES
- See Also:
-
GENERATION_ORIGINAL
static final int GENERATION_ORIGINAL- See Also:
-
GENERATION_COMPONENT
static final int GENERATION_COMPONENT- See Also:
-
MODEL_LEVEL_0_ORIGINAL
static final int MODEL_LEVEL_0_ORIGINAL- See Also:
-
MODEL_LEVEL_1_SYNC_ISSUE
static final int MODEL_LEVEL_1_SYNC_ISSUE- See Also:
-
MODEL_LEVEL_3_VARIANT_OUTPUT_POST_BUILD
static final int MODEL_LEVEL_3_VARIANT_OUTPUT_POST_BUILD- See Also:
-
MODEL_LEVEL_4_NEW_DEP_MODEL
static final int MODEL_LEVEL_4_NEW_DEP_MODEL- See Also:
-
MODEL_LEVEL_LATEST
static final int MODEL_LEVEL_LATEST- See Also:
-
-
Method Details
-
getModelVersion
Returns the model version. This is a string in the format X.Y.Z- Returns:
- a string containing the model version.
-
getApiVersion
int getApiVersion()Returns the model api version.This is different from
getModelVersion()in a way that new model version might increment model version but keep existing api. That means that code which was built against particular 'api version' might be safely re-used for all new model versions as long as they don't change the api.Every new model version is assumed to return an 'api version' value which is equal or greater than the value used by the previous model version.
- Returns:
- model's api version
-
getName
Returns the name of the module.- Returns:
- the name of the module.
-
isLibrary
Deprecated.usegetProjectType()instead.Returns whether this is a library.- Returns:
- true for a library module.
-
getProjectType
int getProjectType()Returns the type of project: Android application, library, feature, instantApp.- Returns:
- the type of project.
- Since:
- 2.3
-
getGroupId
Returns the optional group-id of the artifact represented by this project.- Since:
- 3.6
-
getNamespace
Returns the namespace of the main artifact.This is here rather than on
AndroidArtifactbecause this is common to all artifacts as it cannot be changed per variants. -
getAndroidTestNamespace
Returns the namespace of the AndroidTest artifact.This is here rather than on
AndroidArtifactbecause this is common to all artifacts as it cannot be changed per variants.If there are no AndroidTest components, this returns null.
-
getDefaultConfig
Returns theProductFlavorContainerfor the 'main' default config.- Returns:
- the product flavor.
-
getBuildTypes
Returns a list of all theBuildTypein their container.- Returns:
- a list of build type containers.
-
getProductFlavors
Returns a list of all theProductFlavorin their container.- Returns:
- a list of product flavor containers.
-
getVariants
Returns a list of all the variants. This does not include test variant. Test variants are additional artifacts in their respective variant info.- Returns:
- a list of the variants.
-
getVariantNames
Returns a list of all the variant names.This does not include test variant. Test variants are additional artifacts in their respective variant info.
- Returns:
- a list of all the variant names.
- Since:
- 3.2.
-
getDefaultVariant
Returns the name of the variant the IDE should use when opening the project for the first time.- Returns:
- the name of a variant that exists under the presence of the variant filter. Only returns null if all variants are removed.
- Since:
- 3.5
-
getFlavorDimensions
Returns a list of all the flavor dimensions, may be empty.- Returns:
- a list of the flavor dimensions.
-
getExtraArtifacts
Returns a list of extra artifacts meta data. This does not include the main artifact.- Returns:
- a list of extra artifacts
-
getCompileTarget
Returns the compilation target as a string. This is the full extended target hash string. (see com.android.sdklib.IAndroidTarget#hashString())- Returns:
- the target hash string
-
getBootClasspath
Returns the boot classpath matching the compile target. This is typically android.jar plus other optional libraries.- Returns:
- a list of jar files.
-
getFrameworkSources
Returns a list of folders or jar files that contains the framework source code. -
getNativeToolchains
Returns the collection of toolchains used to create any native libraries.- Returns:
- collection of toolchains.
-
getSigningConfigs
Returns a list ofSigningConfig. -
getAaptOptions
Returns the aapt options. -
getLintOptions
@NonNull com.android.builder.model.LintOptions getLintOptions()Returns the lint options. -
getUnresolvedDependencies
Deprecated.usegetSyncIssues()Returns the dependencies that were not successfully resolved. The returned list gets populated only if the system propertyPROPERTY_BUILD_MODEL_ONLYhas been set totrue.Each value of the collection has the format group:name:version, for example: com.google.guava:guava:15.0.2
- Returns:
- the dependencies that were not successfully resolved.
-
getSyncIssues
Deprecated.requestProjectSyncIssuesinstead.Returns issues found during sync. The returned list gets populated only if the system propertyPROPERTY_BUILD_MODEL_ONLYhas been set totrue. -
getJavaCompileOptions
Returns the compile options for Java code. -
getBuildFolder
Returns the build folder of this project. -
getResourcePrefix
Returns the resource prefix to use, if any. This is an optional prefix which can be set and which is used by the defaults to automatically choose new resources with a certain prefix, warn if resources are not using the given prefix, etc. This helps work with resources in the app namespace where there could otherwise be unintentional duplicated resource names between unrelated libraries.- Returns:
- the optional resource prefix, or null if not set
-
getBuildToolsVersion
Returns the build tools version used by this module.- Returns:
- the build tools version.
-
getNdkVersion
Returns the NDK version used by this module.- Returns:
- the NDK version.
-
getPluginGeneration
int getPluginGeneration()Returns the generation of the plugin.1 is original plugin, 2 is component based plugin (AKA experimental, not used anymore)
- Returns:
- the generation value
-
isBaseSplit
boolean isBaseSplit()Returns true if this is the base feature split.- Returns:
- true if this is the base feature split
- Since:
- 2.4
-
getDynamicFeatures
Returns the list of dynamic features.The values are Gradle path. Only valid for base splits.
- Returns:
-
getViewBindingOptions
Returns the options for view binding. -
getDependenciesInfo
@Nullable com.android.builder.model.DependenciesInfo getDependenciesInfo() -
getFlags
Returns the AGP flags for this project. -
getVariantsBuildInformation
@NonNull Collection<com.android.builder.model.VariantBuildInformation> getVariantsBuildInformation()Returns the minimal information of variants for this project, excluding test related variants.- Since:
- 4.1
-
getLintRuleJars
Returns the lint jars that this module uses to run extra lint checks
-