[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],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)**"]]