com.android.builder.core
Class DefaultProductFlavor

java.lang.Object
  extended by com.android.builder.internal.BaseConfigImpl
      extended by com.android.builder.core.DefaultProductFlavor
All Implemented Interfaces:
com.android.builder.model.BaseConfig, com.android.builder.model.ProductFlavor, java.io.Serializable

public class DefaultProductFlavor
extends com.android.builder.internal.BaseConfigImpl
implements com.android.builder.model.ProductFlavor

The configuration of a product flavor. This is also used to describe the default configuration of all builds, even those that do not contain any flavors.

See Also:
Serialized Form

Constructor Summary
DefaultProductFlavor(java.lang.String name)
          Creates a ProductFlavor with a given name.
 
Method Summary
 void addResourceConfiguration(java.lang.String configuration)
           
 void addResourceConfigurations(java.util.Collection<java.lang.String> configurations)
           
 void addResourceConfigurations(java.lang.String... configurations)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getApplicationId()
          Returns the application ID.
 java.lang.Integer getMaxSdkVersion()
           
 com.android.builder.model.ApiVersion getMinSdkVersion()
          Min SDK version.
 java.lang.String getName()
           
 java.lang.Boolean getRenderscriptNdkModeEnabled()
           
 java.lang.Boolean getRenderscriptSupportModeEnabled()
           
 java.lang.Integer getRenderscriptTargetApi()
           
 java.util.Collection<java.lang.String> getResourceConfigurations()
           
 com.android.builder.model.SigningConfig getSigningConfig()
          Signing config used by this product flavor.
 com.android.builder.model.ApiVersion getTargetSdkVersion()
          Target SDK version.
 java.lang.String getTestApplicationId()
          Test application ID.
 java.lang.Boolean getTestFunctionalTest()
          See instrumentation.
 java.lang.Boolean getTestHandleProfiling()
          See instrumentation.
 java.lang.String getTestInstrumentationRunner()
          Test instrumentation runner class name.
 java.lang.Integer getVersionCode()
          Version code.
 java.lang.String getVersionName()
          Version name.
 int hashCode()
           
 com.android.builder.model.ProductFlavor setApplicationId(java.lang.String applicationId)
          Sets the application id.
 com.android.builder.model.ProductFlavor setMaxSdkVersion(java.lang.Integer maxSdkVersion)
           
 com.android.builder.model.ProductFlavor setMinSdkVersion(com.android.builder.model.ApiVersion minSdkVersion)
          Sets the minSdkVersion to the given value.
 com.android.builder.model.ProductFlavor setRenderscriptNdkModeEnabled(java.lang.Boolean renderscriptNdkMode)
          Sets whether the renderscript code should be compiled to generate C/C++ bindings.
 com.android.builder.model.ProductFlavor setRenderscriptSupportModeEnabled(java.lang.Boolean renderscriptSupportMode)
          Sets whether the renderscript code should be compiled in support mode to make it compatible with older versions of Android.
 void setRenderscriptTargetApi(java.lang.Integer renderscriptTargetApi)
          Sets the renderscript target API to the given value.
 com.android.builder.model.ProductFlavor setSigningConfig(com.android.builder.model.SigningConfig signingConfig)
          Sets the signing configuration.
 com.android.builder.model.ProductFlavor setTargetSdkVersion(com.android.builder.model.ApiVersion targetSdkVersion)
          Sets the targetSdkVersion to the given value.
 com.android.builder.model.ProductFlavor setTestApplicationId(java.lang.String applicationId)
          Sets the test application ID.
 com.android.builder.model.ProductFlavor setTestFunctionalTest(boolean functionalTest)
           
 com.android.builder.model.ProductFlavor setTestHandleProfiling(boolean handleProfiling)
           
 com.android.builder.model.ProductFlavor setTestInstrumentationRunner(java.lang.String testInstrumentationRunner)
          Sets the test instrumentation runner to the given value.
 com.android.builder.model.ProductFlavor setVersionCode(java.lang.Integer versionCode)
          Sets the version code.
 com.android.builder.model.ProductFlavor setVersionName(java.lang.String versionName)
          Sets the version name.
 java.lang.String toString()
           
 
Methods inherited from class com.android.builder.internal.BaseConfigImpl
_initWith, addBuildConfigField, addBuildConfigFields, addManifestPlaceHolders, addResValue, addResValues, getBuildConfigFields, getConsumerProguardFiles, getManifestPlaceholders, getMultiDexEnabled, getMultiDexKeepFile, getMultiDexKeepProguard, getProguardFiles, getResValues, setManifestPlaceholders, setMultiDexEnabled, setMultiDexKeepFile, setMultiDexKeepProguard
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.android.builder.model.BaseConfig
getBuildConfigFields, getConsumerProguardFiles, getManifestPlaceholders, getMultiDexEnabled, getMultiDexKeepFile, getMultiDexKeepProguard, getProguardFiles, getResValues
 

Constructor Detail

DefaultProductFlavor

public DefaultProductFlavor(@NonNull
                            java.lang.String name)
Creates a ProductFlavor with a given name. Names can be important when dealing with flavor groups.

Parameters:
name - the name of the flavor.
See Also:
BuilderConstants.MAIN
Method Detail

getName

@NonNull
public java.lang.String getName()
Specified by:
getName in interface com.android.builder.model.BaseConfig
Specified by:
getName in interface com.android.builder.model.ProductFlavor

setApplicationId

@NonNull
public com.android.builder.model.ProductFlavor setApplicationId(java.lang.String applicationId)
Sets the application id.


getApplicationId

@Nullable
public java.lang.String getApplicationId()
Returns the application ID.

See ApplicationId versus PackageName

Specified by:
getApplicationId in interface com.android.builder.model.ProductFlavor

setVersionCode

@NonNull
public com.android.builder.model.ProductFlavor setVersionCode(java.lang.Integer versionCode)
Sets the version code.

Parameters:
versionCode - the version code
Returns:
the flavor object

getVersionCode

@Nullable
public java.lang.Integer getVersionCode()
Version code.

See Versioning Your Application

Specified by:
getVersionCode in interface com.android.builder.model.ProductFlavor

setVersionName

@NonNull
public com.android.builder.model.ProductFlavor setVersionName(java.lang.String versionName)
Sets the version name.

Parameters:
versionName - the version name
Returns:
the flavor object

getVersionName

@Nullable
public java.lang.String getVersionName()
Version name.

See Versioning Your Application

Specified by:
getVersionName in interface com.android.builder.model.ProductFlavor

setMinSdkVersion

@NonNull
public com.android.builder.model.ProductFlavor setMinSdkVersion(com.android.builder.model.ApiVersion minSdkVersion)
Sets the minSdkVersion to the given value.


getMinSdkVersion

public com.android.builder.model.ApiVersion getMinSdkVersion()
Min SDK version.

Specified by:
getMinSdkVersion in interface com.android.builder.model.ProductFlavor

setTargetSdkVersion

@NonNull
public com.android.builder.model.ProductFlavor setTargetSdkVersion(com.android.builder.model.ApiVersion targetSdkVersion)
Sets the targetSdkVersion to the given value.


getTargetSdkVersion

public com.android.builder.model.ApiVersion getTargetSdkVersion()
Target SDK version.

Specified by:
getTargetSdkVersion in interface com.android.builder.model.ProductFlavor

setMaxSdkVersion

@NonNull
public com.android.builder.model.ProductFlavor setMaxSdkVersion(java.lang.Integer maxSdkVersion)

getMaxSdkVersion

public java.lang.Integer getMaxSdkVersion()
Specified by:
getMaxSdkVersion in interface com.android.builder.model.ProductFlavor

getRenderscriptTargetApi

@Nullable
public java.lang.Integer getRenderscriptTargetApi()
Specified by:
getRenderscriptTargetApi in interface com.android.builder.model.ProductFlavor

setRenderscriptTargetApi

public void setRenderscriptTargetApi(java.lang.Integer renderscriptTargetApi)
Sets the renderscript target API to the given value.


getRenderscriptSupportModeEnabled

@Nullable
public java.lang.Boolean getRenderscriptSupportModeEnabled()
Specified by:
getRenderscriptSupportModeEnabled in interface com.android.builder.model.ProductFlavor

setRenderscriptSupportModeEnabled

public com.android.builder.model.ProductFlavor setRenderscriptSupportModeEnabled(java.lang.Boolean renderscriptSupportMode)
Sets whether the renderscript code should be compiled in support mode to make it compatible with older versions of Android.


getRenderscriptNdkModeEnabled

@Nullable
public java.lang.Boolean getRenderscriptNdkModeEnabled()
Specified by:
getRenderscriptNdkModeEnabled in interface com.android.builder.model.ProductFlavor

setRenderscriptNdkModeEnabled

public com.android.builder.model.ProductFlavor setRenderscriptNdkModeEnabled(java.lang.Boolean renderscriptNdkMode)
Sets whether the renderscript code should be compiled to generate C/C++ bindings.


setTestApplicationId

@NonNull
public com.android.builder.model.ProductFlavor setTestApplicationId(java.lang.String applicationId)
Sets the test application ID.


getTestApplicationId

@Nullable
public java.lang.String getTestApplicationId()
Test application ID.

See ApplicationId versus PackageName

Specified by:
getTestApplicationId in interface com.android.builder.model.ProductFlavor

setTestInstrumentationRunner

@NonNull
public com.android.builder.model.ProductFlavor setTestInstrumentationRunner(java.lang.String testInstrumentationRunner)
Sets the test instrumentation runner to the given value.


getTestInstrumentationRunner

@Nullable
public java.lang.String getTestInstrumentationRunner()
Test instrumentation runner class name.

This is a fully qualified class name of the runner, e.g. android.test.InstrumentationTestRunner

See instrumentation.

Specified by:
getTestInstrumentationRunner in interface com.android.builder.model.ProductFlavor

getTestHandleProfiling

@Nullable
public java.lang.Boolean getTestHandleProfiling()
See instrumentation.

Specified by:
getTestHandleProfiling in interface com.android.builder.model.ProductFlavor

setTestHandleProfiling

@NonNull
public com.android.builder.model.ProductFlavor setTestHandleProfiling(boolean handleProfiling)

getTestFunctionalTest

@Nullable
public java.lang.Boolean getTestFunctionalTest()
See instrumentation.

Specified by:
getTestFunctionalTest in interface com.android.builder.model.ProductFlavor

setTestFunctionalTest

@NonNull
public com.android.builder.model.ProductFlavor setTestFunctionalTest(boolean functionalTest)

getSigningConfig

@Nullable
public com.android.builder.model.SigningConfig getSigningConfig()
Signing config used by this product flavor.

Specified by:
getSigningConfig in interface com.android.builder.model.ProductFlavor

setSigningConfig

@NonNull
public com.android.builder.model.ProductFlavor setSigningConfig(com.android.builder.model.SigningConfig signingConfig)
Sets the signing configuration. e.g.: signingConfig signingConfigs.myConfig


addResourceConfiguration

public void addResourceConfiguration(@NonNull
                                     java.lang.String configuration)

addResourceConfigurations

public void addResourceConfigurations(@NonNull
                                      java.lang.String... configurations)

addResourceConfigurations

public void addResourceConfigurations(@NonNull
                                      java.util.Collection<java.lang.String> configurations)

getResourceConfigurations

@NonNull
public java.util.Collection<java.lang.String> getResourceConfigurations()
Specified by:
getResourceConfigurations in interface com.android.builder.model.ProductFlavor

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class com.android.builder.internal.BaseConfigImpl

hashCode

public int hashCode()
Overrides:
hashCode in class com.android.builder.internal.BaseConfigImpl

toString

@NonNull
public java.lang.String toString()
Overrides:
toString in class com.android.builder.internal.BaseConfigImpl