Skip to main content

android_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] = ...,
_cxx_toolchain: str = ...,
_is_building_android_binary: bool = ...,
_is_force_single_cpu: bool = ...,
_is_force_single_default_cpu: bool = ...,
_java_toolchain: str = ...,
abi_generation_mode: None | str = ...,
annotation_processing_tool: None | str = ...,
annotation_processor_deps: list[str] = ...,
annotation_processor_params: list[str] = ...,
annotation_processors: list[str] = ...,
build_config_values: list[str] = ...,
build_config_values_file: None | str = ...,
compress_asset_libraries: bool = ...,
contacts: list[str] = ...,
cpu_filters: list[str] = ...,
default_host_platform: None | str = ...,
deps: list[str] = ...,
enable_relinker: bool = ...,
excluded_java_deps: list[str] = ...,
extra_arguments: list[str] = ...,
extra_kotlinc_arguments: list[str] = ...,
friend_paths: list[str] = ...,
include_build_config_class: bool = ...,
java_version: None | str = ...,
javac: None | str = ...,
labels: list[str] = ...,
language: None | str = ...,
licenses: list[str] = ...,
manifest: None | str = ...,
manifest_entries: dict[str, typing.Any] = ...,
manifest_file: None | str = ...,
manifest_skeleton: str,
maven_coords: None | str = ...,
min_sdk_version: None | int = ...,
native_library_bolt_args: None | dict[str, list[str]] = ...,
native_library_merge_code_generator: None | str = ...,
native_library_merge_glue: None | str = ...,
native_library_merge_linker_args: None | dict[str, list[str]] = ...,
native_library_merge_linker_args_all: list[str] = ...,
native_library_merge_map: None | dict[str, list[str]] = ...,
native_library_merge_non_asset_libs: bool = ...,
native_library_merge_sequence: None | list = ...,
native_library_merge_sequence_blocklist: None | list[str] = ...,
never_mark_as_unused_dependency: None | bool = ...,
on_unused_dependencies: None | str = ...,
package_asset_libraries: bool = ...,
package_resources: bool = ...,
plugins: list[str | (str, list[str])] = ...,
proguard_config: None | str = ...,
relinker_extra_args: list[str] = ...,
relinker_extra_deps: list[str] = ...,
relinker_whitelist: list[str] = ...,
remove_classes: list[str] = ...,
required_for_source_only_abi: bool = ...,
resource_union_package: None | str = ...,
resources: list[str] = ...,
resources_root: None | str = ...,
runtime_deps: list[str] = ...,
source: None | str = ...,
source_abi_verification_mode: None | str = ...,
source_only_abi_deps: list[str] = ...,
srcs: list[str] = ...,
strip_libraries: bool = ...,
target: None | str = ...,
use_jvm_abi_gen: None | bool = ...,
) -> None

An android_aar() rule is used to generate an Android AAR.

Parameters

  • name: name of the target
  • default_target_platform: specifies the default target platform, used when no platforms are specified on the command line
  • target_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration
  • compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration
  • exec_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
  • visibility: a list of visibility patterns restricting what targets can depend on this one
  • within_view: a list of visibility patterns restricting what this target can depend on
  • metadata: a key-value map of metadata associated with this target
  • tests: a list of targets that provide tests for this one
  • modifiers: an array of modifiers associated with this target
  • build_config_values: See the documentation on the values argument for android_build_config().
  • include_build_config_class: Whether to include the BuildConfig class files in the final .aar file. Needs to be set to True if any build_config_values are specified. This is normally only needed if the build tool that is consuming the .aar file does not generate BuildConfig classes. Note: the AAR format does not specify a way to pass defaults that should be injected into the final BuildConfig class, therefore that information might need to be replicated manually in the build that's consuming the .aar file.
  • javac: Specifies the Java compiler program to use for this rule. The value is a source path or an execution dep (e.g., //foo/bar:bar). Overrides the value in "javac" in the "tools" section of .buckconfig.
  • manifest_skeleton: The skeleton manifest file used to generate the final AndroidManifest.xml . May either be a file or an android_manifest() target.
  • native_library_merge_linker_args_all: Extra linker arguments passed to all merged libraries.
  • relinker_extra_args: Extra arguments passed when relinking all libraries.
  • remove_classes: List of classes to remove from the output aar. It removes classes from the target's own sources, and its dependencies.

Details

See the official Android documentation for details about the .aar format.

Examples:


android_resource(
name = 'res',
res = 'res',
assets = 'assets',
package = 'com.example',
)

android_library(
name = 'lib',
srcs = glob(['**/*.java']),
)

android_aar(
name = 'app',
manifest_skeleton = 'AndroidManifestSkeleton.xml',
deps = [
':res',
':lib',
],
)