Categorygithub.com/bitrise-steplib/bitrise-step-android-build
modulepackage
0.0.0-20240226152816-bfebd365051f
Repository: https://github.com/bitrise-steplib/bitrise-step-android-build.git
Documentation: pkg.go.dev

# README

Android Build

Step changelog

Builds your Android project with Gradle.

Description

The Step builds your Android project on Bitrise with Gradle commands: it installs all dependencies that are listed in the project's build.gradle file, and builds and exports either an APK or an AAB. Once the file is exported, it is available for other Steps in your Workflow.

You can select the module and the variant you want to use for the build.

Configuring the Step

  1. Make sure the Project Location input points to the root directory of your Android project.

  2. In the Module input, set the module that you want to build.

    You can find the available modules in Android Studio.

  3. In the Variant input, set the variant that you want to build.

    You can find the available variants in Android Studio.

  4. In the Build type input, select the file type you want to build.

    The options are:

    • apk
    • aab
  5. In the Options input group, you can set more advanced configuration options for the Step:

    • In the App artifact (.apk, .aab) location pattern input, you can tell the Step where to look for the APK or AAB files in your project to export them. For the vast majority of Android projects, the default values do NOT need to be changed.

    • In the Additional Gradle Arguments, you can add additional command line arguments to the Gradle task. Read more about Gradle's Command Line Interface.

    • The Set the level of cache input allows you to set what will be cached during the build: everything, dependencies only, or nothing.

Troubleshooting

Be aware that an APK or AAB built by the Step is still unsigned: code signing is performed either in Gradle itself or by other Steps. To be able to deploy your APK or AAB to an online store, you need code signing.

If you want to build a custom module or variant, always check that the value you set in the respective input is correct. A typo means your build will fail; if the module or variant does not exist in Android Studio, the build will fail.

Useful links

Related Steps

🧩 Get started

Add this step directly to your workflow in the Bitrise Workflow Editor.

You can also run this step directly with Bitrise CLI.

Examples

Build an APK from the debug variant:

- android-build:
    inputs:
    - variant: debug
    - build_type: apk

Build a release AAB:

- android-build:
    inputs:
    - variant: release
    - build_type: aab

⚙️ Configuration

Inputs
KeyDescriptionFlagsDefault
project_locationThe root directory of your Android project. For example, where your root build gradle file exist (also gradlew, settings.gradle, and so on)required$BITRISE_SOURCE_DIR
moduleSet the module that you want to build. To see your available modules, please open your project in Android Studio and go in [Project Structure] and see the list on the left.
variantSet the build variants you want to create. To see your available variants, open your project in Android Studio and go in [Project Structure] -> variants section. This input also accepts multiple variants, separated by a line break.
build_typeSet the build type that you want to build.requiredapk
app_path_patternWill find the APK or AAB files - depending on the Build type input - with the given pattern.
Separate patterns with a newline. Note
The Step will export only the selected artifact type even if the filter would accept other artifact types as well.
required*/build/outputs/apk/*.apk */build/outputs/bundle/*.aab
cache_levelall - The Step will cache build cache and the dependencies only_deps - The Step will cache dependencies only none - The Step will not cache anythingrequiredonly_deps
argumentsExtra arguments passed to the gradle task
Outputs
Environment VariableDescription
BITRISE_APK_PATHThis output will include the path of the generated APK after filtering based on the filter inputs. If the build generates more than one APK which fulfills the filter inputs, this output will contain the last one's path.
BITRISE_APK_PATH_LISTThis output will include the paths of the generated APKs after filtering based on the filter inputs. The paths are separated with | character, for example, app-armeabi-v7a-debug.apk|app-mips-debug.apk|app-x86-debug.apk
BITRISE_AAB_PATHThis output will include the path of the generated AAB after filtering based on the filter inputs. If the build generates more than one AAB which fulfills the filter inputs, this output will contain the last one's path.
BITRISE_AAB_PATH_LISTThis output will include the paths of the generated AABs after filtering based on the filter inputs. The paths are separated with | character, for example, app--debug.aab|app-mips-debug.aab
BITRISE_MAPPING_PATHThis output will include the path of the generated mapping.txt. If more than one mapping.txt exist in the project, this output will contain the last one's path.

🙋 Contributing

We welcome pull requests and issues against this repository.

For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.

Learn more about developing steps:

# Packages

No description provided by the author