Buck: android_aar()

android_aar()

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

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

Arguments

  • name (required) #

    The name of the rule.

  • manifest_skeleton (required) #

    The skeleton manifest file used to generate the final AndroidManifest.xml. May either be a file or a android_manifest target.

  • build_config_values (defaults to []) #

    See the documentation on the values argument for android_build_config.

  • include_build_config_class (defaults to False) #

    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.

  • deps (defaults to []) #

    List of build targets whose corresponding compiled Java code, Android resources, and native libraries will be included in the AAR.

    • android_library() Will be included in the final classes.jar
    • android_resource() Will be included in the final R.txt, res/ and assets/
    • android_build_config() Will be included in the final classes.jar if include_build_config_class is True
    • groovy_library() Will be included in the final classes.jar
    • java_library() Will be included in the final classes.jar
    • prebuilt_jar() Will be included in the final classes.jar
    • ndk_library() Will be included in the final jni/ or assets/ if is_asset is True
    • prebuilt_native_library() Will be included in the final jni/ or assets/ if is_asset is True

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule in its deps.

  • licenses (defaults to []) #

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query.

  • labels (defaults to []) #

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query attrfilter.

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',
  ],
)