|
This rule has an implicit dependency on unified_launcher, which is hosted in an external repository at https://github.com/google/android-testing-support-library and must be set up in the WORKSPACE file with repository name @android_test_support. A future change will introduce an Android tools set-up macro that will create workspace rules for all of the remote Android tools, including unified_launcher.
Note that unified_launcher is not supported on Mac or Windows, so Bazel will only be able to successfully build the android_device rule on Linux.
Instructions to set up unified_launcher for use with android_device:
1. Install xvfb
2. In your WORKSPACE add
```
android_sdk_repository(name = "androidsdk") # Also set $ANDROID_HOME
git_repository(
name = "android_test_support",
remote = "https://github.com/google/android-testing-support-library",
commit = "79725fed7a6884074fb3647a683869e7141ecf64",
)
load(
"@android_test_support//tools/android/emulator:unified_launcher.bzl",
load_unified_launcher_deps = "load_workspace")
load_unified_launcher_deps()
```
In your BUILD file, you can create an android_device rule for a system image that you have installed in your Android SDK as:
```
android_device(
name = "my_device",
cache = 256,
default_properties = "@bazel_tools//tools/android/emulator:no_se_linux.properties",
horizontal_resolution = 640,
vertical_resolution = 800,
screen_density = 133,
ram = 2048,
vm_heap = 256,
system_image = "@androidsdk//:android-23_default_x86_files",
)
```
RELNOTES: Introduces experimental android_device rule for configuring and launching Android emulators.
PiperOrigin-RevId: 151766489
|