Bug: 181693809

Clone this repo:
  1. 1ad7fd4 Merge remote-tracking branch 'aosp/upstream-main' into HEAD by Romain Jobredeaux · 9 days ago main master
  2. 0ba0453 Migrate AppendJava8LegacyDex and BuildLegacyDex action from native to Starlark by Zhaoqing Xu · 13 days ago upstream-pre-alpha
  3. 035371c Migrate DexArchiveAspect from native Blaze to Starlark, and also add 2 new processors in android_binary_internal: DexProcessor and DeployJarProcessor by Zhaoqing Xu · 13 days ago
  4. d704aa7 Internal Change by Zhaoqing Xu · 13 days ago
  5. d05c7cd Make default_applicable_licenses usage consistent by Ted Xie · 14 days ago

Android support in Bazel


NOTE: This branch contains a development preview of the Starlark implementation of Android rules for Bazel. This code is incomplete and may not function as-is.

A version of Bazel built at or near head or a recent pre-release and the following flags are necessary to use these rules:



This repository contains the Starlark implementation of Android rules in Bazel.

The rules are being incrementally converted from their native implementations in the Bazel source tree.

For the list of Android rules, see the Bazel documentation.

Getting Started

To use the Starlark Bazel Android rules, add the following to your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Or a later commit
RULES_ANDROID_COMMIT= "0bf3093bd011acd35de3c479c8990dd630d552aa"
RULES_ANDROID_SHA = "b75a673a66c157138ab53f4d8612a6e655d38b69bb14207c1a6675f0e10afa61"
    name = "build_bazel_rules_android",
    url = "https://github.com/bazelbuild/rules_android/archive/%s.zip" % RULES_ANDROID_COMMIT,
    sha256 = RULES_ANDROID_SHA,
    strip_prefix = "rules_android-%s" % RULES_ANDROID_COMMIT,
load("@build_bazel_rules_android//:prereqs.bzl", "rules_android_prereqs")
load("@build_bazel_rules_android//:defs.bzl", "rules_android_workspace")


Then, in your BUILD files, import and use the rules:

load("@build_bazel_rules_android//rules:rules.bzl", "android_binary", "android_library")