android_prebuilt_aar
name
def name(
*,
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
_android_toolchain: str = ...,
_apple_platforms: dict[str, str] = ...,
_build_only_native_code: bool = ...,
_dex_min_sdk_version: None | int = ...,
_dex_toolchain: str = ...,
_exec_os_type: str = ...,
_java_toolchain: str = ...,
aar: str,
contacts: list[str] = ...,
default_host_platform: None | str = ...,
deps: list[str] = ...,
desugar_deps: list[str] = ...,
dex_weight_factor: int = ...,
for_primary_apk: bool = ...,
javadoc_url: None | str = ...,
labels: list[str] = ...,
licenses: list[str] = ...,
maven_coords: None | str = ...,
required_for_source_only_abi: bool = ...,
source_jar: None | str = ...,
use_system_library_loader: bool = ...,
) -> None
An android_prebuilt_aar()
rule takes an .aar
file and makes it available as an Android dependency. As expected, an android_binary()
that transitively depends on an android_prebuilt_aar()
will include its contents in the generated APK.
Parameters
name
: name of the targetdefault_target_platform
: specifies the default target platform, used when no platforms are specified on the command linetarget_compatible_with
: a list of constraints that are required to be satisfied for this target to be compatible with a configurationcompatible_with
: a list of constraints that are required to be satisfied for this target to be compatible with a configurationexec_compatible_with
: a list of constraints that are required to be satisfied for this target to be compatible with an execution platformvisibility
: a list of visibility patterns restricting what targets can depend on this onewithin_view
: a list of visibility patterns restricting what this target can depend onmetadata
: a key-value map of metadata associated with this targettests
: a list of targets that provide tests for this onemodifiers
: an array of modifiers associated with this targetaar
: Path to the.aar
file. This may also be a build target to a rule (such as agenrule()
) whose output is an.aar
file.javadoc_url
: URL to the Javadoc for the.class
files in theaar
.source_jar
: Path to a JAR file that contains the.java
files to create the.class
in theaar
. This is frequently provided for debugging purposes.use_system_library_loader
: If this.aar
file contains native prebuilt.so
libraries and the Java code uses these libraries via a call toSystem.loadLibrary()
, then many optimizations—such as exopackage, compression, or asset packaging—may not be compatible with these prebuilt libs. Setting this parameter toTrue
causes all of these optimizations to skip the prebuilt.so
files originating from this.aar
file. The.so
files will always be packaged directly into the main.apk
.
Details
See the official Android documentation for details about the .aar
format.
Examples:
android_prebuilt_aar(
name = 'play-services',
aar = 'play-services-4.0.30.aar',
source_jar = 'play-services-4.0.30-sources.jar',
javadoc_url = 'file:///opt/android-sdk/extras/google/google_play_services/docs/reference',
)
android_library(
name = 'lib',
# This Java code can compile against Play services and reference its resources.
srcs = glob(['*.java']),
deps = [ ':play-services' ],
)