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",
# ...
}
)
You can use this to automatically sign and zipalign your app:
gradle(
task: "assemble",
build_type: "Release",
print_command: false,
properties: {
"android.injected.signing.store.file" => "keystore.jks",
"android.injected.signing.store.password" => "store_password",
"android.injected.signing.key.alias" => "key_alias",
"android.injected.signing.key.password" => "key_password",
}
)
# 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 | Default |
---|---|---|
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[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 | . |
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 | |
system_properties |
Gradle system 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) | true |
print_command_output |
Control whether the output produced by given Gradle command is printed while running (true/false) | true |
* = default value is dependent on the user's system
To show the documentation in your terminal, run
fastlane action gradle