ApiJarProcessor

Subclass of ArtifactArchiveProcessor to allow for producing an api.jar element inside an AAR file.

The api.jar file is an optional element that contains information about the library's public API. This file helps developers using the library understand its exposed classes, methods, and functionalities. When this file exists in an AAR package, it will be used it as the source of truth for which members are exposed externally by the AAR, and which members can be referenced at compile time.

Generating a custom api.jar file can be used to hide certain public members from IDE autocomplete, though they can still be referenced and invoked via reflection at runtime as per usual.

This has no effect if applied to a module that does not produce an Android AAR file.

Functions

Link copied to clipboard
open fun isEnabled(): Boolean

Whether the processor is enabled or not. If false, no api.jar file will be produced.

Link copied to clipboard
open override fun process(archive: ArtifactArchive): ArtifactArchive
Link copied to clipboard
abstract fun processClasspath(aarArchive: AarArchive, classpath: MutableClasspath)

Provides the processor with the merged AAR file and a MutableClasspath from which an api.jar will be based on. The classpath defaults to the public API of AarArchive.classes, but supports adding/removing/altering classes.