Buck: android_prebuilt_aar()
Support Ukraine. Help Provide Humanitarian Aid to Ukraine.


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.

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


  • name (required) #

    The short name for this build target.

  • aar (required) #

    Path to the .aar file. This may also be a build target to a rule (such as a genrule) whose output is an .aar file.

  • source_jar (defaults to None) #

    Path to a JAR file that contains the .java files to create the .class in the aar. This is frequently provided for debugging purposes.

  • javadoc_url (defaults to None) #

    URL to the Javadoc for the .class files in the aar.

  • use_system_library_loader (defaults to False) #

    If this .aar file contains native prebuilt .so libraries and the Java code uses these libraries via a call to System.loadLibrary(), then many optimizations—such as exopackage, compression, or asset packaging—may not be compatible with these prebuilt libs. Setting this parameter to True causes all of these optimizations to skip the prebuilt .sofiles originating from this .aar file. The .so files will always be packaged directly into the main .apk.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their deps or exported_deps attributes. For more information, see visibility.

  • 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().


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

  name = 'lib',
  # This Java code can compile against Play services and reference its resources.
  srcs = glob(['*.java']),
  deps = [ ':play-services' ],