This message was deleted.
# android
s
This message was deleted.
x
The Android plugin exposes 2 different extensions. The first one is the main DSL where you set values. The 2nd one is the entry point for the Variant API. Its lifecyle is really different from the DSL so we wanted to separate them.
1
v
I have a special use-case with the old variants API to access the connectedInstrumentTestProvider
Copy code
var androidExtension = project.extensions.getByName("android") as AppExtension
var appVariants = androidExtension.applicationVariants

appVariants.configureEach{ variant ->
     variant.testVariant.connectedInstrumentTestProvider.configure {
             instrumentationTestTask ->
                        // configure the task here
   }
}
Considering the fact that the old variants API is deprecated in favor of the new how can i access the connectedInstrumentTestProvider This is how I use the new API but cannot configure connectedInstrumentTestProvider
Copy code
var androidComponentExtension = project.extensions.getByType(AndroidComponentsExtension::class.java)
var appVariants = androidExtension.applicationVariants

componentExtension.onVariants { variant ->

     // connectedInstrumentTestProvider is unavailable to configure onVariants / beforeVaraints

}
x
What are you doing on that test task? In general we really don't want users to tweak the tasks themselves. I would recommend filing a feature request with your use case. https://issuetracker.google.com/issues/new?component=192708&template=840533