ApkOutput

Added in 8.9.0-alpha01

@Incubating
interface ApkOutput


Provides an ordered collection of APK batches, each intended for local installation, facilitating staged installations.

An instance of ApkOutput can be obtained via ApplicationVariant.outputProviders

As an example , let's take a Gradle org.gradle.api.Task that needs all the Apks for local deployment:

abstract class FetchApkTask: DefaultTask() {
@get:Internal
abstract val apkOutput: Property<com.android.build.api.variant.ApkOutput>

@TaskAction
fun execute() {
def apkInstallGroups = apkOutput.apkInstallGroups
for(installGroup: installGroups) {
installOnDevice(installGroup.apks)
}
}
}
def taskProvider = tasks.register<FetchApkTask>("installAppApks")
androidComponents {
onVariants(selector().withName("debug")) { variant ->
val appVariant = variant as? ApplicationVariant
if (appVariant != null) {
appVariant.outputProviders.provideApkOutputToTask(taskProvider, FetchApkTask::getOutput, DeviceSpec("testDevice", 33, "", [], true))
}
}
}

Summary

Public properties

List<ApkInstallGroup>

Returns an ordered collection of co-installable APK batches targeted for a specific device.

Public properties

apkInstallGroups

Added in 8.9.0-alpha01
val apkInstallGroupsList<ApkInstallGroup>

Returns an ordered collection of co-installable APK batches targeted for a specific device.