Google is committed to advancing racial equity for Black communities. See how.

InstrumentationParameters

@Incubating interface InstrumentationParameters : Serializable
com.android.build.api.instrumentation.InstrumentationParameters

Parameters for a registered AsmClassVisitorFactory.

Build authors should extend this interface with any additional inputs needed for their ASM visitor.

The parameters will be instantiated using ObjectFactory.newInstance, configured using the given config when registering the visitor, and injected to the factory on instantiation.

The parameters will be used as Gradle inputs. Make sure to declare the inputs by annotating them using Gradle's input annotations so it's compatible with Gradle's up-to-date checks.

Example:

interface ParametersImpl : InstrumentationParameters {
  @get:Input
  val intValue: Property<Int>

  @get:Internal
  val listOfStrings: ListProperty<String>
}

androidExtension.onVariantProperties {
    transformClassesWith(AsmClassVisitorFactoryImpl.class,
                         InstrumentationScope.Project) { params ->
        // parameters configuration
        params.intValue.set(1)
        params.listOfStrings.set(listOf("a", "b"))
    }
}

Summary