gradle

All gradle related actions, including building and testing your Android app

Run ./gradlew tasks to get a list of all available gradle tasks for your project

gradle
Supported platforms ios, android
Author @KrauseFx, @lmirosevic
Returns The output of running the gradle task

3 Examples

gradle(
  task: "assemble",
  flavor: "WorldDomination",
  build_type: "Release"
)
gradle(
  # ...

  properties: {
    "versionCode" => 100,
    "versionName" => "1.0.0",
    # ...
  }
)
# If you need to pass sensitive information through the `gradle` action, and don"t want the generated command to be printed before it is run, you can suppress that:
gradle(
  # ...
  print_command: false
)

You can also suppress printing the output generated by running the generated Gradle command:

gradle(
  # ...
  print_command_output: false
)

To pass any other CLI flags to gradle use:

gradle(
  # ...

  flags: "--exitcode --xml file.xml"
)

Parameters

Key Description
task The gradle task you want to execute, e.g. assemble or test. For tasks such as assembleMyFlavorRelease you should use gradle(task: 'assemble', flavor: 'Myflavor', build_type: 'Release')
flavor The flavor that you want the task for, e.g. MyFlavor. If you are running the assemble task in a multi-flavor project, and you rely on Actions.lane_context[Actions.SharedValues::GRADLE_APK_OUTPUT_PATH] then you must specify a flavor here or else this value will be undefined
build_type The build type that you want the task for, e.g. Release. Useful for some tasks such as assemble
flags All parameter flags you want to pass to the gradle command, e.g. --exitcode --xml file.xml
project_dir The root directory of the gradle project. Defaults to .
gradle_path The path to your gradlew. If you specify a relative path, it is assumed to be relative to the project_dir
properties Gradle properties to be exposed to the gradle script
serial Android serial, which device should be used for this command
print_command Control whether the generated Gradle command is printed as output before running it (true/false)
print_command_output Control whether the output produced by given Gradle command is printed while running (true/false)


To show the documentation in your terminal, run

fastlane action gradle

View source code


Back to actions