android_prebuilt_aar()
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.
Arguments
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 agenrule
) whose output is an.aar
file.source_jar
(defaults toNone
) #Path to a JAR file that contains the
.java
files to create the.class
in theaar
. This is frequently provided for debugging purposes.javadoc_url
(defaults toNone
) #URL to the Javadoc for the
.class
files in theaar
.use_system_library_loader
(defaults toFalse
) #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
.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
orexported_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()
.
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' ], )