[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Troubleshoot build performance with Build Analyzer\n\nUse the Build Analyzer to inspect the build performance of your project. For\neach build you perform, the Build Analyzer tries to present the most important\ninformation so that you can quickly identify and resolve regressions in your\nbuild performance.\n\nFor additional strategies on improving build performance, read\n[Optimize your build speed](/studio/build/optimize-your-build).\n| **Note:** The Build Analyzer doesn't display data for all tasks in your build. Instead, it focuses on only the tasks that determine your build's total duration.\n\nGet started\n-----------\n\nEach time you build your app, the Build Analyzer creates a report and displays\ndata from the latest report in the **Build** window.\n\nTo get started, proceed as follows:\n\n1. If you haven't already done so, build your app in one of the following ways:\n - Click **Build \\\u003e Make Project** from the menu bar.\n - To build an Android App Bundle or APK, click **Build \\\u003e Build Bundle(s)\n / APK(s) \\\u003e Build Bundle(s)** or **Build \\\u003e Build Bundle(s) / APK(s) \\\u003e\n Build APK(s)** from the menu bar.\n2. To open the **Build** window, select **View \\\u003e Tool Windows \\\u003e Build** from the menu bar.\n3. To view the build report in the **Build Analyzer** , click the **Build Analyzer** tab in the **Build** window.\n\nThe data that the Build Analyzer presents might change across builds, so it's\nhelpful to build your project multiple times and compare the data to identify\npatterns.\n\nView plugins with tasks determining the build's duration\n--------------------------------------------------------\n\nWhen you first open the Build Analyzer after completing a build, the window\ndisplays an overview of the build analysis, as shown in figure 1.\n**Figure 1.** The Build Analyzer overview page gives a summary of the findings.\n\nTo see a breakdown of plugins with tasks determining the build's duration, click\n**Plugins with tasks impacting build duration** on the overview page. You can\nalso select **Tasks** from the dropdown and confirm that you're grouping by\nplugin. The graph orders the plugins and their related tasks by the total time\nthey take to complete.\n**Figure 2.** The Build Analyzer provides a breakdown of plugins that affect your build's duration.\n\nView tasks determining the build's duration\n-------------------------------------------\n\nTo view a breakdown of the tasks that contribute to your build's duration, click\n**Tasks impacting build duration** on the overview page or select **Tasks** from\nthe dropdown. If your project uses AGP 8.0 or higher the tasks are grouped by\ncategory by default, so it's easier to identify areas that impact build\nduration. Click on each child task to learn more about its execution.\n**Figure 3.** The Build Analyzer provides a breakdown of tasks most responsible for your build's duration.\n\nInspect warnings\n----------------\n\nIf the Build Analyzer detects that some tasks could be configured to run more\nefficiently, it provides a warning. To see all the warnings the Build Analyzer\nhas identified for your build, click on **All warnings** on the overview page or\nselect **Warnings** from the dropdown.\n\nSome warnings have a **Generate report** link, as shown in figure 4. When you\nclick the **Generate report** link, a dialog appears with additional information\nthat might help the plugin developer resolve the issue in a new version of the\nplugin. Click **Copy** to save the text to your clipboard to more easily paste\nthe information into a bug report to the plugin developer.\n**Figure 4.** Detailed information about Build Analyzer warnings.\n\n### Warning types\n\nThe Build Analyzer reports the following warning types:\n\n- **Always run tasks**: An always running task makes other tasks run on every\n build, which is unnecessary. There are two main reasons why you might see this\n warning:\n\n - (More common) You did not declare task inputs and outputs correctly. If this\n is the case, you should [properly declare the inputs and outputs for your\n tasks](https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:up_to_date_checks).\n This means declaring inputs and outputs yourself where you can or changing\n plugin versions if the tasks triggering the warning are from third-party\n plugins.\n\n - (Less common) A task has `upToDateWhen` set to false, which should be\n avoided. It could be that there is some logic that evaluates to false or that\n `upToDateWhen` is hardcoded to be false. If there is logic that evaluates to\n false, this outcome might be intentional, and you might choose to ignore the\n warning. If `upToDateWhen` is hardcoded to be false, you should remove the\n hardcoding from your code.\n\n- **Task setup issues** : This warning is generated for tasks that declare the\n same directory as outputs. This means that those tasks outputs are most likely\n not being preserved between builds and those tasks always run, even when\n there are no changes. To address this warning you should\n [declare different output directories for your\n tasks](https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:up_to_date_checks).\n This means declaring different output directories yourself where you can or\n changing plugin versions if the tasks triggering the warning are from\n third-party plugins.\n\n- **Non-incremental annotation processor:** This warning is generated in\n situations where an annotation processor is non-incremental and causes the\n `JavaCompile` task to always run non-incrementally. To address this warning,\n [switch to an incremental annotation\n processor](/studio/build/optimize-your-build?utm_source=android-studio#incremental-annotation-processor-support).\n\n- **Configuration cache:** This warning is presented if [configuration\n caching](https://medium.com/androiddevelopers/configuration-caching-deep-dive-bcb304698070)\n is not enabled for your project. The Build Analyzer walks through a sequence of\n builds to check whether your project is compatible with configuration caching.\n If the compatibility checks are successful, you can turn configuration caching\n on from the Build Analyzer.\n\n- **Check Jetifier:** This warning is presented if the\n [`enableJetifier` flag is present](/jetpack/androidx/migrate)\n and enabled in your project; that is, if you have `android.enableJetifier=true`\n in your `gradle.properties` file. The Build Analyzer can perform a check to see\n whether the flag can be safely removed to enable your project to have better\n build performance and migrate away from the unmaintained Android Support\n libraries.\n\nCheck download impact\n---------------------\n\nBuild Analyzer provides a summary of time spent downloading dependencies and a\ndetailed view of downloads per repository. To check the impact of downloads,\nselect **Downloads** from the dropdown. This info is also available in the\n[**Sync**](/studio/run#gradle-console) window.\n\nYou can use this information to determine whether unexpected dependency\ndownloads are negatively impacting your build performance. This is especially\nimportant during incremental builds, which shouldn't consistently download\nartifacts.\n\nSpecifically, you can use this information to identify configuration issues,\nsuch as use of dynamic versions of dependencies that cause unexpected downloads.\nAlso, if you see a high number of failed requests for a specific repository, it\ncould indicate that the repository should be removed or moved lower in your\nrepository configuration.\n**Figure 5.** The Build Analyzer shows the impact of downloads on build duration.\n\n\\[Windows-only\\] Check antivirus software impact\n------------------------------------------------\n\nBuild Analyzer informs you if antivirus software might be impacting your build\nperformance. This can happen if antivirus software, such as Windows Defender,\nis doing real-time scanning of directories used by Gradle. Build Analyzer\nrecommends a list of directories to exclude from active scanning and, if\npossible, it offers a link to add them to the Windows Defender folder exclusion\nlist."]]