Stay organized with collections
Save and categorize content based on your preferences.
Continuous Integration (CI) is a software development practice where developers
frequently merge their code changes into a central repository, after which
automated builds and tests run.
You can set up a basic CI system to prevent new changes that would break the
build after merging in. You can program a more advanced CI system to
automatically test the app and make sure it behaves as expected in different
environments, such as API levels, screen sizes, and platforms.
Figure 1. A CI system keeps a code repository healthy by running checks before merging.
This document demonstrates common strategies developers use to set up effective
CI systems for Android projects. These guidelines are generic and apply to the
majority of solutions.
Typical example
A typical CI system follows a workflow or pipeline, which might look as
follows:
The CI system detects a change in the code, usually when a developer creates
a pull request, also called "change list" or "merge request".
It provisions and initializes a server to run the workflow.
It fetches the code as well as tools such as the Android SDK or emulator
images if needed.
It builds the project by running a given command, for example ./gradlew
build.
It runs the local tests by running a given command, for example running
./gradlew test.
It uploads artifacts such as test results and APKs.
Figure 2. A basic CI workflow
Benefits of CI
The advantages of CI include:
Improved quality of software: CI can help to improve the quality of
software by identifying and fixing problems early on. This can help to reduce
the number of bugs in software releases and improve the overall user
experience.
Reduced risk of broken builds: When you automate your build process with
CI you can better avoid broken builds by resolving issues earlier in the
process.
Increased confidence in releases: CI can help to ensure that each release
is stable and ready for production. By running automated tests, CI can
identify any potential problems before you release them to the public.
Improved communication and collaboration: By providing a central place for
developers to share code and test results, CI can help to make it easier for
developers and other team members to work together and track progress.
Increased productivity: CI can help to increase developer productivity by
automating tasks that would otherwise be time-consuming and error-prone.
Further reading
More more information on how you can use constant integration to improve
development for your app, read the following pages:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Continuous Integration basics\n\nContinuous Integration (CI) is a software development practice where developers\nfrequently merge their code changes into a central repository, after which\nautomated builds and tests run.\n\nYou can set up a basic CI system to prevent new changes that would break the\nbuild after merging in. You can program a more advanced CI system to\nautomatically test the app and make sure it behaves as expected in different\nenvironments, such as API levels, screen sizes, and platforms.\n**Figure 1.** A CI system keeps a code repository healthy by running checks before merging.\n\nThis document demonstrates common strategies developers use to set up effective\nCI systems for Android projects. These guidelines are generic and apply to the\nmajority of solutions.\n\nTypical example\n---------------\n\nA typical CI system follows a *workflow* or *pipeline*, which might look as\nfollows:\n\n1. The CI system detects a change in the code, usually when a developer creates a pull request, also called \"change list\" or \"merge request\".\n2. It provisions and initializes a server to run the workflow.\n3. It fetches the code as well as tools such as the Android SDK or emulator images if needed.\n4. It builds the project by running a given command, for example .`/gradlew\n build`.\n5. It runs the [local tests](/training/testing/local-tests) by running a given command, for example running .`/gradlew test`.\n6. It starts emulators and runs the [instrumented tests](/training/testing/instrumented-tests).\n7. It uploads artifacts such as test results and APKs.\n\n**Figure 2.** A basic CI workflow\n\nBenefits of CI\n--------------\n\nThe advantages of CI include:\n\n- **Improved quality of software**: CI can help to improve the quality of software by identifying and fixing problems early on. This can help to reduce the number of bugs in software releases and improve the overall user experience.\n- **Reduced risk of broken builds**: When you automate your build process with CI you can better avoid broken builds by resolving issues earlier in the process.\n- **Increased confidence in releases**: CI can help to ensure that each release is stable and ready for production. By running automated tests, CI can identify any potential problems before you release them to the public.\n- **Improved communication and collaboration**: By providing a central place for developers to share code and test results, CI can help to make it easier for developers and other team members to work together and track progress.\n- **Increased productivity**: CI can help to increase developer productivity by automating tasks that would otherwise be time-consuming and error-prone.\n\nFurther reading\n---------------\n\nMore more information on how you can use constant integration to improve\ndevelopment for your app, read the following pages:\n\n- **[CI Automation](/training/testing/continuous-integration/automation)**\n\n- **[CI Features](/training/testing/continuous-integration/features)**"]]