• Home
  • API Basevariant getapplicationidtextresource is obsolete and has been replaced with variantproperties applicationid – Android

API Basevariant getapplicationidtextresource is obsolete and has been replaced with variantproperties applicationid – Android

The getApplicationIdTextResource method of the BaseVariant class in Android has been deprecated and replaced with the variantProperties.applicationId property. This change was made to provide a more consistent naming scheme for accessing variant-specific properties.

To update your code to use the new property, simply replace any instances of getApplicationIdTextResource with variantProperties.applicationId. For example:

// Old way (deprecated)
String appId = variant.getApplicationIdTextResource();

// New way
String appId = variant.variantProperties.applicationId;

Keep in mind that you may need to import the com.android.build.api.variant.VariantProperties class in order to access the variantProperties property.