android preview list

Lists available Jetpack Compose @Preview functions in a target.

Usage

android preview list [-h] [--all] [--build-system=PARAM] [--build-working-dir=PARAM] [--build-workspace=PARAM] [--format=PARAM] [<reference>] [-- <build_args>]

Options

  • --all - Include previews from dependent modules in the workspace (excludes .gradle, third_party, and external directories).
  • --build-system=PARAM - Build system name, for example gradle, bazel, or a custom build system from .androidconfig (by default, detected from the workspace).
  • --build-working-dir=PARAM - Directory to resolve the build from (the default value is the current directory).
  • --build-workspace=PARAM - Workspace root directory (by default, detected from the working directory).
  • -f,--format=PARAM - Output format ('text' or 'json'; default: 'text').
  • -h,--help - Shows the help message for the specified command.

android options:

  • --sdk=PARAM - Path to the Android SDK.
  • -v,--verbose - Enable verbose output for troubleshooting.
  • -V,--version - Print version information and exit.

Positional arguments

  • <reference> - Build reference ([system://][path]?[target]).
  • -- <build_args> - Arguments passed verbatim to the build system. Use -- to separate from other arguments.

Description

android preview list compiles the target and scans its classpath for Jetpack Compose @Preview functions (including custom MultiPreview annotations), printing their fully qualified names to standard output.

Pass a build reference ([system://][path]?[target]) to select the workspace and target to inspect, or omit <reference> to use the default target in the current workspace.

In Gradle workspaces, target has the form [<project>][@<variant>] (for example, :app, :app@freeDebug for a product flavor and build type, or @freeDebug for the module in the build working directory). When @<variant> is omitted, the variant defaults to debug; if the module defines product flavors and has no debug variant, specify @<variant> explicitly.

Filter and format preview list output

  • --all: Includes @Preview functions from dependent targets in the workspace (excluding .gradle, third_party, and external directories).
  • -f, --format: Selects text (default, one fully qualified method name per line) or structured json output.

Examples

List @Preview functions in :app in the current Gradle workspace:

android preview list :app

List @Preview functions in the freeDebug variant of :app:

android preview list :app@freeDebug

List @Preview functions across :app and its workspace dependencies in JSON format:

android preview list :app --all --format=json