Macrobenchmark Instrumentation Arguments

Stay organized with collections Save and categorize content based on your preferences.

Configure the behavior of the library with the following instrumentation arguments. These can either be added to your Gradle configuration or applied directly when running instrumentation from the command line.

androidx.benchmark.compilation.enabled

Allows disabling compilation between each iteration of the benchmark. By default, the target application is re-installed and re-compiled between each benchmark, to respect the CompilationMode passed into measureRepeated. Disabling this allows you to skip both reinstall and compilation if, for example, you want to fully compile the target app once before running the test suite, and run all benchmarks against that fully compiled target.

  • Argument type: boolean
  • Defaults to: true

androidx.benchmark.enabledRules

Allows filtering runs to just one type of test - Baseline Profile generation or Macrobenchmark test. Comma-separated list also supported.

  • Argument type: string
  • Available options:
    • Macrobenchmark
    • BaselineProfile
  • Defaults to: Not specified

androidx.benchmark.suppressErrors

Accepts comma-separated list of errors to turn into warnings.

  • Argument type: list of strings
  • Available options:
    • DEBUGGABLE
    • LOW-BATTERY
    • EMULATOR
    • NOT-PROFILEABLE
  • Defaults to: an empty list

additionalTestOutputDir

Configures where JSON benchmark reports and profiling results are saved on device.

  • Argument type: file path string
  • Defaults to: test APK's external directory