CINXE.COM
Configure your build | Android Studio | Android Developers
<!doctype html> <html lang="en" dir="ltr"> <head> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award"> <meta property="og:site_name" content="Android Developers"> <meta property="og:type" content="website"><meta name="theme-color" content="#34a853"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/_pwa/android/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//www.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.googleapis.com" crossorigin> <link rel="preconnect" href="//apis.google.com" crossorigin> <link rel="preconnect" href="//www.google-analytics.com" crossorigin><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500,600,700|Google+Sans+Text:400,400italic,500,500italic,600,600italic,700,700italic|Roboto+Mono:400,500,700&display=swap"> <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"><link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/css/app.css"> <link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/css/dark-theme.css" disabled> <link rel="shortcut icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/favicon.svg"> <link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/touchicon-180.png"><link rel="canonical" href="https://developer.android.com/build"><link rel="search" type="application/opensearchdescription+xml" title="Android Developers" href="https://developer.android.com/s/opensearch.xml"> <link rel="alternate" hreflang="en" href="https://developer.android.com/build" /><link rel="alternate" hreflang="x-default" href="https://developer.android.com/build" /><link rel="alternate" hreflang="ar" href="https://developer.android.com/build?hl=ar" /><link rel="alternate" hreflang="bn" href="https://developer.android.com/build?hl=bn" /><link rel="alternate" hreflang="zh-Hans" href="https://developer.android.com/build?hl=zh-cn" /><link rel="alternate" hreflang="zh-Hant" href="https://developer.android.com/build?hl=zh-tw" /><link rel="alternate" hreflang="fa" href="https://developer.android.com/build?hl=fa" /><link rel="alternate" hreflang="fr" href="https://developer.android.com/build?hl=fr" /><link rel="alternate" hreflang="de" href="https://developer.android.com/build?hl=de" /><link rel="alternate" hreflang="he" href="https://developer.android.com/build?hl=he" /><link rel="alternate" hreflang="hi" href="https://developer.android.com/build?hl=hi" /><link rel="alternate" hreflang="id" href="https://developer.android.com/build?hl=id" /><link rel="alternate" hreflang="it" href="https://developer.android.com/build?hl=it" /><link rel="alternate" hreflang="ja" href="https://developer.android.com/build?hl=ja" /><link rel="alternate" hreflang="ko" href="https://developer.android.com/build?hl=ko" /><link rel="alternate" hreflang="pl" href="https://developer.android.com/build?hl=pl" /><link rel="alternate" hreflang="pt-BR" href="https://developer.android.com/build?hl=pt-br" /><link rel="alternate" hreflang="ru" href="https://developer.android.com/build?hl=ru" /><link rel="alternate" hreflang="es-419" href="https://developer.android.com/build?hl=es-419" /><link rel="alternate" hreflang="th" href="https://developer.android.com/build?hl=th" /><link rel="alternate" hreflang="tr" href="https://developer.android.com/build?hl=tr" /><link rel="alternate" hreflang="vi" href="https://developer.android.com/build?hl=vi" /><title>Configure your build | Android Studio | Android Developers</title> <meta property="og:title" content="Configure your build | Android Studio | Android Developers"><meta name="description" content="The Android build system compiles app resources and source code and packages them into APKs that you can test, deploy, sign, and distribute."> <meta property="og:description" content="The Android build system compiles app resources and source code and packages them into APKs that you can test, deploy, sign, and distribute."><meta property="og:url" content="https://developer.android.com/build"><meta property="og:image" content="https://developer.android.com/static/images/social/android-developers.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="675"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "Configure your build" } </script><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Android Studio", "item": "https://developer.android.com/studio" },{ "@type": "ListItem", "position": 2, "name": "Configure your build", "item": "https://developer.android.com/build" }] } </script> <link rel="stylesheet" href="/extras.css"></head> <body class="" template="page" theme="android-theme" type="article" appearance layout="docs" display-toc pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"> <devsite-cookie-notification-bar></devsite-cookie-notification-bar><devsite-header role="banner"> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="androidDevelopers" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <source srcset="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup-dark-theme.svg" media="(prefers-color-scheme: dark)" class="devsite-dark-theme" alt="Android Developers"> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup.svg" class="devsite-site-logo" alt="Android Developers"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> <devsite-tabs class="upper-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Upper tabs"> <tab class="devsite-dropdown devsite-dropdown-full "> <a href="https://developer.android.com/get-started" track-metadata-eventdetail="https://developer.android.com/get-started" class="devsite-tabs-content gc-analytics-event android-dropdown-tab" track-type="nav" track-metadata-position="nav - essentials" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Essentials" track-name="essentials" > Essentials </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Essentials" track-type="nav" track-metadata-eventdetail="https://developer.android.com/get-started" track-metadata-position="nav - essentials" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Essentials" track-name="essentials" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column android-dropdown android-dropdown-primary android-dropdown-studio"> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-title" role="heading" tooltip>Gemini in Android Studio</li> <li class="devsite-nav-description">Your AI development companion for Android development. </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/gemini-in-android" track-type="nav" track-metadata-eventdetail="https://developer.android.com/gemini-in-android" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="gemini in android studio" tooltip class="button button-primary" > <div class="devsite-nav-item-title"> Learn more </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/studio" track-type="nav" track-metadata-eventdetail="https://developer.android.com/studio" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="gemini in android studio" tooltip class="button button-white" > <div class="devsite-nav-item-title"> Get Android Studio </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-launch"> <li class="devsite-nav-title" role="heading" tooltip>Get started</li> <li class="devsite-nav-description">Start by creating your first app. Go deeper with our training courses or explore app development on your own. </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/get-started/overview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/get-started/overview" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get started" tooltip > <div class="devsite-nav-item-title"> Hello world </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/courses" track-type="nav" track-metadata-eventdetail="https://developer.android.com/courses" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get started" tooltip > <div class="devsite-nav-item-title"> Training courses </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/get-started/codelabs" track-type="nav" track-metadata-eventdetail="https://developer.android.com/get-started/codelabs" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get started" tooltip > <div class="devsite-nav-item-title"> Tutorials </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/kotlin" track-type="nav" track-metadata-eventdetail="https://developer.android.com/kotlin" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get started" tooltip > <div class="devsite-nav-item-title"> Kotlin for Android </div> </a> </li> <li class="devsite-nav-item"> <a href="https://play.google.com/console/about/guides/monetize/" track-type="nav" track-metadata-eventdetail="https://play.google.com/console/about/guides/monetize/" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get started" tooltip > <div class="devsite-nav-item-title"> Monetization with Play ↗️ </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-multiple-screens"> <li class="devsite-nav-title" role="heading" tooltip>Extend by device</li> <li class="devsite-nav-description">Build apps that give your users seamless experiences from phones to tablets, watches, and more. </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/adaptive-apps" track-type="nav" track-metadata-eventdetail="https://developer.android.com/adaptive-apps" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="extend by device" tooltip > <div class="devsite-nav-item-title"> Adaptive apps </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/wear" track-type="nav" track-metadata-eventdetail="https://developer.android.com/wear" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="extend by device" tooltip > <div class="devsite-nav-item-title"> Wear OS </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/cars" track-type="nav" track-metadata-eventdetail="https://developer.android.com/cars" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="extend by device" tooltip > <div class="devsite-nav-item-title"> Android for Cars </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/tv" track-type="nav" track-metadata-eventdetail="https://developer.android.com/tv" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="extend by device" tooltip > <div class="devsite-nav-item-title"> Android TV </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/chrome-os" track-type="nav" track-metadata-eventdetail="https://developer.android.com/chrome-os" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="extend by device" tooltip > <div class="devsite-nav-item-title"> ChromeOS </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/multi-device-development" track-type="nav" track-metadata-eventdetail="https://developer.android.com/multi-device-development" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="extend by device" tooltip > <div class="devsite-nav-item-title"> Cross-device SDK </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-platform"> <li class="devsite-nav-title" role="heading" tooltip>Build by category</li> <li class="devsite-nav-description">Learn to build for your use case by following Google's prescriptive and opinionated guidance. </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/games" track-type="nav" track-metadata-eventdetail="https://developer.android.com/games" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="build by category" tooltip > <div class="devsite-nav-item-title"> Games </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/media" track-type="nav" track-metadata-eventdetail="https://developer.android.com/media" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="build by category" tooltip > <div class="devsite-nav-item-title"> Camera & Media </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/social-and-messaging" track-type="nav" track-metadata-eventdetail="https://developer.android.com/social-and-messaging" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="build by category" tooltip > <div class="devsite-nav-item-title"> Social & messaging </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/health-and-fitness" track-type="nav" track-metadata-eventdetail="https://developer.android.com/health-and-fitness" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="build by category" tooltip > <div class="devsite-nav-item-title"> Health & Fitness </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/productivity" track-type="nav" track-metadata-eventdetail="https://developer.android.com/productivity" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="build by category" tooltip > <div class="devsite-nav-item-title"> Productivity </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/work/overview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/work/overview" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="build by category" tooltip > <div class="devsite-nav-item-title"> Enterprise apps </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-stars"> <li class="devsite-nav-title" role="heading" tooltip>Get the latest</li> <li class="devsite-nav-description">Stay in touch with the latest releases throughout the year, join our preview programs, and give us your feedback. </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/latest-updates" track-type="nav" track-metadata-eventdetail="https://developer.android.com/latest-updates" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get the latest" tooltip > <div class="devsite-nav-item-title"> Latest updates </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/latest-updates/experimental" track-type="nav" track-metadata-eventdetail="https://developer.android.com/latest-updates/experimental" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get the latest" tooltip > <div class="devsite-nav-item-title"> Experimental updates </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/studio/preview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/studio/preview" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get the latest" tooltip > <div class="devsite-nav-item-title"> Android Studio preview </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/jetpack/androidx/versions" track-type="nav" track-metadata-eventdetail="https://developer.android.com/jetpack/androidx/versions" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get the latest" tooltip > <div class="devsite-nav-item-title"> Jetpack & Compose libraries </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/training/wearables/versions/4" track-type="nav" track-metadata-eventdetail="https://developer.android.com/training/wearables/versions/4" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get the latest" tooltip > <div class="devsite-nav-item-title"> Wear OS preview </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design-for-safety/privacy-sandbox" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design-for-safety/privacy-sandbox" track-metadata-position="nav - essentials" track-metadata-module="tertiary nav" track-metadata-module_headline="get the latest" tooltip > <div class="devsite-nav-item-title"> Privacy Sandbox </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-dropdown-full "> <a href="https://developer.android.com/design" track-metadata-eventdetail="https://developer.android.com/design" class="devsite-tabs-content gc-analytics-event android-dropdown-tab" track-type="nav" track-metadata-position="nav - design & plan" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Design & Plan" track-name="design & plan" > Design & Plan </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Design & Plan" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design" track-metadata-position="nav - design & plan" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Design & Plan" track-name="design & plan" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-layout"> <li class="devsite-nav-title" role="heading" tooltip>UI Design</li> <li class="devsite-nav-description">Design a beautiful user interface using Android best practices.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design/ui" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design/ui" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="ui design" tooltip > <div class="devsite-nav-item-title"> Design for Android </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design/ui/mobile" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design/ui/mobile" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="ui design" tooltip > <div class="devsite-nav-item-title"> Mobile </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design/ui/large-screens" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design/ui/large-screens" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="ui design" tooltip > <div class="devsite-nav-item-title"> Large screens (e.g., tablets) </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design/ui/widget" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design/ui/widget" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="ui design" tooltip > <div class="devsite-nav-item-title"> Widgets </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design/ui/wear" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design/ui/wear" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="ui design" tooltip > <div class="devsite-nav-item-title"> Wear OS </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/design/ui/tv" track-type="nav" track-metadata-eventdetail="https://developer.android.com/design/ui/tv" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="ui design" tooltip > <div class="devsite-nav-item-title"> Android TV </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-design"> <li class="devsite-nav-title" role="heading" tooltip>Architecture</li> <li class="devsite-nav-description">Design robust, testable, and maintainable app logic and services.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/topic/architecture/intro" track-type="nav" track-metadata-eventdetail="https://developer.android.com/topic/architecture/intro" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="architecture" tooltip > <div class="devsite-nav-item-title"> Introduction </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/topic/libraries/view-binding" track-type="nav" track-metadata-eventdetail="https://developer.android.com/topic/libraries/view-binding" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="architecture" tooltip > <div class="devsite-nav-item-title"> Libraries </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/guide/navigation/navigation-principles" track-type="nav" track-metadata-eventdetail="https://developer.android.com/guide/navigation/navigation-principles" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="architecture" tooltip > <div class="devsite-nav-item-title"> Navigation </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/topic/modularization" track-type="nav" track-metadata-eventdetail="https://developer.android.com/topic/modularization" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="architecture" tooltip > <div class="devsite-nav-item-title"> Modularization </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/training/testing/fundamentals" track-type="nav" track-metadata-eventdetail="https://developer.android.com/training/testing/fundamentals" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="architecture" tooltip > <div class="devsite-nav-item-title"> Testing </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-vitals"> <li class="devsite-nav-title" role="heading" tooltip>Quality</li> <li class="devsite-nav-description">Plan for app quality and align with Play store guidelines.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/quality" track-type="nav" track-metadata-eventdetail="https://developer.android.com/quality" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="quality" tooltip > <div class="devsite-nav-item-title"> Overview </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/quality/core-value" track-type="nav" track-metadata-eventdetail="https://developer.android.com/quality/core-value" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="quality" tooltip > <div class="devsite-nav-item-title"> Core value </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/quality/user-experience" track-type="nav" track-metadata-eventdetail="https://developer.android.com/quality/user-experience" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="quality" tooltip > <div class="devsite-nav-item-title"> User experience </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/quality/technical" track-type="nav" track-metadata-eventdetail="https://developer.android.com/quality/technical" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="quality" tooltip > <div class="devsite-nav-item-title"> Technical quality </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/quality/privacy-and-security" track-type="nav" track-metadata-eventdetail="https://developer.android.com/quality/privacy-and-security" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="quality" tooltip > <div class="devsite-nav-item-title"> Security </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-security-2"> <li class="devsite-nav-title" role="heading" tooltip>Security</li> <li class="devsite-nav-description">Safeguard users against threats and ensure a secure Android experience.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/security" track-type="nav" track-metadata-eventdetail="https://developer.android.com/security" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="security" tooltip > <div class="devsite-nav-item-title"> Overview </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/privacy-and-security/about" track-type="nav" track-metadata-eventdetail="https://developer.android.com/privacy-and-security/about" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="security" tooltip > <div class="devsite-nav-item-title"> Privacy </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/identity" track-type="nav" track-metadata-eventdetail="https://developer.android.com/identity" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="security" tooltip > <div class="devsite-nav-item-title"> Identity </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/security/fraud-prevention" track-type="nav" track-metadata-eventdetail="https://developer.android.com/security/fraud-prevention" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="security" tooltip > <div class="devsite-nav-item-title"> Fraud prevention </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-earth"> <li class="devsite-nav-title" role="heading" tooltip>Build for Billions</li> <li class="devsite-nav-description">Create the best experience for entry-level devices</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/build-for-billions" track-type="nav" track-metadata-eventdetail="https://developer.android.com/build-for-billions" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="build for billions" tooltip > <div class="devsite-nav-item-title"> Overview </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/docs/quality-guidelines/build-for-billions" track-type="nav" track-metadata-eventdetail="https://developer.android.com/docs/quality-guidelines/build-for-billions" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="build for billions" tooltip > <div class="devsite-nav-item-title"> About new markets </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/guide/topics/androidgo" track-type="nav" track-metadata-eventdetail="https://developer.android.com/guide/topics/androidgo" track-metadata-position="nav - design & plan" track-metadata-module="tertiary nav" track-metadata-module_headline="build for billions" tooltip > <div class="devsite-nav-item-title"> Android (Go edition) </div> </a> </li> </ul> </div> </div> </div> </tab> <tab class="devsite-dropdown devsite-dropdown-full devsite-active "> <a href="https://developer.android.com/develop" track-metadata-eventdetail="https://developer.android.com/develop" class="devsite-tabs-content gc-analytics-event android-dropdown-tab" track-type="nav" track-metadata-position="nav - develop" track-metadata-module="primary nav" aria-label="Develop, selected" data-category="Site-Wide Custom Events" data-label="Tab: Develop" track-name="develop" > Develop </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Develop" track-type="nav" track-metadata-eventdetail="https://developer.android.com/develop" track-metadata-position="nav - develop" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Develop" track-name="develop" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column android-dropdown android-dropdown-primary android-dropdown-ai"> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-title" role="heading" tooltip>Build AI experiences</li> <li class="devsite-nav-description">Build AI-powered Android apps with Gemini APIs and more. </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/ai" track-type="nav" track-metadata-eventdetail="https://developer.android.com/ai" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="build ai experiences" tooltip class="button button-primary" > <div class="devsite-nav-item-title"> Get started </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-flag"> <li class="devsite-nav-title" role="heading" tooltip>Core areas</li> <li class="devsite-nav-description">Get the samples and docs for the features you need.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/samples" track-type="nav" track-metadata-eventdetail="https://developer.android.com/samples" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> Samples </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/quick-guides" track-type="nav" track-metadata-eventdetail="https://developer.android.com/quick-guides" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> Try Quick Guidesᵇᵉᵗᵃ </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/develop/ui" track-type="nav" track-metadata-eventdetail="https://developer.android.com/develop/ui" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> User interfaces </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/guide/topics/permissions/overview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/guide/topics/permissions/overview" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> Permissions </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/develop/background-work" track-type="nav" track-metadata-eventdetail="https://developer.android.com/develop/background-work" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> Background work </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/guide/topics/data" track-type="nav" track-metadata-eventdetail="https://developer.android.com/guide/topics/data" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> Data and files </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/develop#core-areas" track-type="nav" track-metadata-eventdetail="https://developer.android.com/develop#core-areas" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="core areas" tooltip > <div class="devsite-nav-item-title"> All core areas ⤵️ </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-tools-2"> <li class="devsite-nav-title" role="heading" tooltip>Tools and workflow</li> <li class="devsite-nav-description">Use the IDE to write and build your app, or create your own pipeline.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/studio/write" track-type="nav" track-metadata-eventdetail="https://developer.android.com/studio/write" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="tools and workflow" tooltip > <div class="devsite-nav-item-title"> Write and debug code </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/build/gradle-build-overview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/build/gradle-build-overview" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="tools and workflow" tooltip > <div class="devsite-nav-item-title"> Build projects </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/training/testing" track-type="nav" track-metadata-eventdetail="https://developer.android.com/training/testing" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="tools and workflow" tooltip > <div class="devsite-nav-item-title"> Test your app </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/topic/performance/overview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/topic/performance/overview" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="tools and workflow" tooltip > <div class="devsite-nav-item-title"> Performance </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/tools" track-type="nav" track-metadata-eventdetail="https://developer.android.com/tools" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="tools and workflow" tooltip > <div class="devsite-nav-item-title"> Command-line tools </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/reference/tools/gradle-api" track-type="nav" track-metadata-eventdetail="https://developer.android.com/reference/tools/gradle-api" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="tools and workflow" tooltip > <div class="devsite-nav-item-title"> Gradle plugin API </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-multiple-screens"> <li class="devsite-nav-title" role="heading" tooltip>Device tech</li> <li class="devsite-nav-description">Write code for form factors. Connect devices and share data.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/guide/topics/large-screens/get-started-with-large-screens" track-type="nav" track-metadata-eventdetail="https://developer.android.com/guide/topics/large-screens/get-started-with-large-screens" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> Large screens (e.g., tablets) </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/training/wearables" track-type="nav" track-metadata-eventdetail="https://developer.android.com/training/wearables" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> Wear OS </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/health-and-fitness/guides" track-type="nav" track-metadata-eventdetail="https://developer.android.com/health-and-fitness/guides" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> Android Health </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/guide/topics/connectivity/cross-device-sdk/overview" track-type="nav" track-metadata-eventdetail="https://developer.android.com/guide/topics/connectivity/cross-device-sdk/overview" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> Cross-device SDK </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/training/cars" track-type="nav" track-metadata-eventdetail="https://developer.android.com/training/cars" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> Android for Cars </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/training/tv" track-type="nav" track-metadata-eventdetail="https://developer.android.com/training/tv" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> Android TV </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/chrome-os/intro" track-type="nav" track-metadata-eventdetail="https://developer.android.com/chrome-os/intro" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="device tech" tooltip > <div class="devsite-nav-item-title"> ChromeOS </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column android-dropdown"> <ul class="devsite-tabs-dropdown-section android-dropdown-section-icon android-dropdown-section-icon-core-library"> <li class="devsite-nav-title" role="heading" tooltip>Libraries</li> <li class="devsite-nav-description">Browse API reference documentation with all the details.</li> <li class="devsite-nav-item"> <a href="https://developer.android.com/reference/packages" track-type="nav" track-metadata-eventdetail="https://developer.android.com/reference/packages" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="libraries" tooltip > <div class="devsite-nav-item-title"> Android platform </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/jetpack/androidx/explorer" track-type="nav" track-metadata-eventdetail="https://developer.android.com/jetpack/androidx/explorer" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="libraries" tooltip > <div class="devsite-nav-item-title"> Jetpack libraries </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developer.android.com/jetpack/androidx/releases/compose" track-type="nav" track-metadata-eventdetail="https://developer.android.com/jetpack/androidx/releases/compose" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="libraries" tooltip > <div class="devsite-nav-item-title"> Compose libraries </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/android/reference/packages" track-type="nav" track-metadata-eventdetail="https://developers.google.com/android/reference/packages" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="libraries" tooltip > <div class="devsite-nav-item-title"> Google Play services ↗️ </div> </a> </li> <li class="devsite-nav-item"> <a href="https://play.google.com/sdks" track-type="nav" track-metadata-eventdetail="https://play.google.com/sdks" track-metadata-position="nav - develop" track-metadata-module="tertiary nav" track-metadata-module_headline="libraries" tooltip > <div class="devsite-nav-item-title"> Google Play SDK index ↗️ </div> </a> </li> </ul> </div> </div> </div> </tab> <tab > <a href="https://developer.android.com/distribute" track-metadata-eventdetail="https://developer.android.com/distribute" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - google play" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Google Play" track-name="google play" > Google Play </a> </tab> <tab > <a href="https://developer.android.com/community" track-metadata-eventdetail="https://developer.android.com/community" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - community" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Community" track-name="community" > Community </a> </tab> </nav> </devsite-tabs> </div> <devsite-search enable-signin enable-search enable-suggestions enable-query-completion project-name="Android Studio" tenant-name="Android Developers" > <form class="devsite-search-form" action="https://developer.android.com/s/results" method="GET"> <div class="devsite-search-container"> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value="" > <div class="devsite-search-image material-icons" aria-hidden="true"> </div> <div class="devsite-search-shortcut-icon-container" aria-hidden="true"> <kbd class="devsite-search-shortcut-icon">/</kbd> </div> </div> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-appearance-selector></devsite-appearance-selector> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pl" >Polski</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="vi" >Tiếng Việt</a> </li> <li role="presentation"> <a role="menuitem" lang="tr" >Türkçe</a> </li> <li role="presentation"> <a role="menuitem" lang="ru" >Русский</a> </li> <li role="presentation"> <a role="menuitem" lang="he" >עברית</a> </li> <li role="presentation"> <a role="menuitem" lang="ar" >العربيّة</a> </li> <li role="presentation"> <a role="menuitem" lang="fa" >فارسی</a> </li> <li role="presentation"> <a role="menuitem" lang="hi" >हिंदी</a> </li> <li role="presentation"> <a role="menuitem" lang="bn" >বাংলা</a> </li> <li role="presentation"> <a role="menuitem" lang="th" >ภาษาไทย</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_tw" >中文 – 繁體</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> <a class="devsite-header-link devsite-top-button button gc-analytics-event" href="https://developer.android.com/studio" data-category="Site-Wide Custom Events" data-label="Site header link" > Android Studio </a> <devsite-user enable-profiles id="devsite-user"> <span class="button devsite-top-button" aria-hidden="true" visually-hidden>Sign in</span> </devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-product-id-row" > <div class="devsite-product-description-row"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> <a href="https://developer.android.com/studio" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Lower Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Android Studio" > Android Studio </a> </li> </ul> </div> </div> <div class="devsite-doc-set-nav-row"> <devsite-tabs class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab > <a href="https://developer.android.com/studio" track-metadata-eventdetail="https://developer.android.com/studio" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - download" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Download" track-name="download" > Download </a> </tab> <tab > <a href="https://developer.android.com/studio/intro" track-metadata-eventdetail="https://developer.android.com/studio/intro" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - android studio editor" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Android Studio editor" track-name="android studio editor" > Android Studio editor </a> </tab> <tab > <a href="https://developer.android.com/gemini-in-android" track-metadata-eventdetail="https://developer.android.com/gemini-in-android" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - gemini in android studio" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Gemini in Android Studio" track-name="gemini in android studio" > Gemini in Android Studio </a> </tab> <tab class="devsite-active"> <a href="https://developer.android.com/build/gradle-build-overview" track-metadata-eventdetail="https://developer.android.com/build/gradle-build-overview" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - android gradle plugin" track-metadata-module="primary nav" aria-label="Android Gradle Plugin, selected" data-category="Site-Wide Custom Events" data-label="Tab: Android Gradle Plugin" track-name="android gradle plugin" > Android Gradle Plugin </a> </tab> <tab > <a href="https://developer.android.com/tools" track-metadata-eventdetail="https://developer.android.com/tools" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - sdk tools" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: SDK tools" track-name="sdk tools" > SDK tools </a> </tab> <tab > <a href="https://developer.android.com/studio/preview" track-metadata-eventdetail="https://developer.android.com/studio/preview" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - preview" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Preview" track-name="preview" > Preview </a> </tab> </nav> </devsite-tabs> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars > <div class="devsite-book-nav-filter" > <span class="filter-list-icon material-icons" aria-hidden="true"></span> <input type="text" placeholder="Filter" aria-label="Type to filter" role="searchbox"> <span class="filter-clear-button hidden" data-title="Clear filter" aria-label="Clear filter" role="button" tabindex="0"></span> </div> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="androidDevelopers" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <source srcset="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup-dark-theme.svg" media="(prefers-color-scheme: dark)" class="devsite-dark-theme" alt="Android Developers"> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup.svg" class="devsite-site-logo" alt="Android Developers"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/get-started" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Essentials" track-name="essentials" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Essentials" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Essentials </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Essentials" track-name="essentials" > <span class="devsite-nav-text" tooltip menu="Essentials"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Essentials"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/design" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Design & Plan" track-name="design & plan" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Design & Plan" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Design & Plan </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Design & Plan" track-name="design & plan" > <span class="devsite-nav-text" tooltip menu="Design & Plan"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Design & Plan"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/develop" class="devsite-nav-title gc-analytics-event devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Develop" track-name="develop" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Develop" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Develop </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Develop" track-name="develop" > <span class="devsite-nav-text" tooltip menu="Develop"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Develop"> </span> </span> </li> </ul> <ul class="devsite-nav-responsive-tabs"> <li class="devsite-nav-item"> <a href="/studio" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Download" track-name="download" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Download" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Download </span> </a> </li> <li class="devsite-nav-item"> <a href="/studio/intro" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Android Studio editor" track-name="android studio editor" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android Studio editor" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android Studio editor </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/gemini-in-android" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Gemini in Android Studio" track-name="gemini in android studio" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Gemini in Android Studio" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Gemini in Android Studio </span> </a> </li> <li class="devsite-nav-item"> <a href="/build/gradle-build-overview" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Android Gradle Plugin" track-name="android gradle plugin" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android Gradle Plugin" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip menu="_book"> Android Gradle Plugin </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="_book"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/tools" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: SDK tools" track-name="sdk tools" data-category="Site-Wide Custom Events" data-label="Responsive Tab: SDK tools" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > SDK tools </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/studio/preview" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Preview" track-name="preview" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Preview" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Preview </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/distribute" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Google Play" track-name="google play" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Play" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Play </span> </a> </li> <li class="devsite-nav-item"> <a href="/community" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Community" track-name="community" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Community" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Community </span> </a> </li> <li class="devsite-nav-item"> <a href="/studio" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android Studio" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android Studio </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>What's new in Android build</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/releases/gradle-plugin" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/releases/gradle-plugin" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/releases/gradle-plugin" ><span class="devsite-nav-text" tooltip>Android Gradle Plugin 8.7 release notes</span></a></li><li class="devsite-nav-item"><a href="/build/releases/gradle-plugin-roadmap" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/releases/gradle-plugin-roadmap" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/releases/gradle-plugin-roadmap" ><span class="devsite-nav-text" tooltip>Android Gradle Plugin roadmap</span></a></li><li class="devsite-nav-item"><a href="/build/releases/gradle-plugin-api-updates" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/releases/gradle-plugin-api-updates" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/releases/gradle-plugin-api-updates" ><span class="devsite-nav-text" tooltip>Android Gradle plugin API updates</span></a></li><li class="devsite-nav-item"><a href="/build/releases/past-releases" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/releases/past-releases" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/releases/past-releases" ><span class="devsite-nav-text" tooltip>Past Android Gradle Plugin releases</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Android build overview</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/gradle-build-overview" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/gradle-build-overview" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/gradle-build-overview" ><span class="devsite-nav-text" tooltip>Gradle build overview</span></a></li><li class="devsite-nav-item"><a href="/build/android-build-structure" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/android-build-structure" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/android-build-structure" ><span class="devsite-nav-text" tooltip>Android build structure</span></a></li><li class="devsite-nav-item"><a href="/build/tool-and-library-dependencies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/tool-and-library-dependencies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/tool-and-library-dependencies" ><span class="devsite-nav-text" tooltip>Tool and library interdependencies</span></a></li><li class="devsite-nav-item"><a href="/build/gradle-dependency-resolution" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/gradle-dependency-resolution" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/gradle-dependency-resolution" ><span class="devsite-nav-text" tooltip>Gradle dependency resolution</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage your build</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build" ><span class="devsite-nav-text" tooltip>Configure the Android build system</span></a></li><li class="devsite-nav-item"><a href="/build/annotation-processors" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/annotation-processors" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/annotation-processors" ><span class="devsite-nav-text" tooltip>Add annotation processors</span></a></li><li class="devsite-nav-item"><a href="/build/jdks" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/jdks" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/jdks" ><span class="devsite-nav-text" tooltip>Java versions in Android builds</span></a></li><li class="devsite-nav-item"><a href="/build/configure-app-module" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/configure-app-module" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/configure-app-module" ><span class="devsite-nav-text" tooltip>Configure the app module</span></a></li><li class="devsite-nav-item"><a href="/build/manage-manifests" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/manage-manifests" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/manage-manifests" ><span class="devsite-nav-text" tooltip>Manage manifest files</span></a></li><li class="devsite-nav-item"><a href="/build/custom-build-logic" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/custom-build-logic" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/custom-build-logic" ><span class="devsite-nav-text" tooltip>Apply custom build logic</span></a></li><li class="devsite-nav-item"><a href="/build/build-variants" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/build-variants" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/build-variants" ><span class="devsite-nav-text" tooltip>Configure build variants</span></a></li><li class="devsite-nav-item"><a href="/build/agp-upgrade-assistant" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/agp-upgrade-assistant" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/agp-upgrade-assistant" ><span class="devsite-nav-text" tooltip>Use the Android Gradle plugin Upgrade Assistant</span></a></li><li class="devsite-nav-item"><a href="/build/sdk-upgrade-assistant" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/sdk-upgrade-assistant" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/sdk-upgrade-assistant" ><span class="devsite-nav-text" tooltip>Use the Android SDK Upgrade Assistant</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Manage dependencies</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/dependencies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/dependencies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/dependencies" ><span class="devsite-nav-text" tooltip>Add build dependencies</span></a></li><li class="devsite-nav-item"><a href="/build/native-dependencies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/native-dependencies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/native-dependencies" ><span class="devsite-nav-text" tooltip>Add native dependencies</span></a></li><li class="devsite-nav-item"><a href="/build/remote-repositories" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/remote-repositories" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/remote-repositories" ><span class="devsite-nav-text" tooltip>Manage remote repositories</span></a></li><li class="devsite-nav-item"><a href="/build/version-upgrade-strategies" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/version-upgrade-strategies" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/version-upgrade-strategies" ><span class="devsite-nav-text" tooltip>Upgrade build dependencies</span></a></li><li class="devsite-nav-item"><a href="/build/dependency-upgrade-tools" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/dependency-upgrade-tools" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/dependency-upgrade-tools" ><span class="devsite-nav-text" tooltip>Analyze and automate dependency upgrades</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Run your build</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/building-cmdline" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/building-cmdline" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/building-cmdline" ><span class="devsite-nav-text" tooltip>Build your app from the command line</span></a></li><li class="devsite-nav-item"><a href="/build/build-for-release" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/build-for-release" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/build-for-release" ><span class="devsite-nav-text" tooltip>Build your app for release to users</span></a></li><li class="devsite-nav-item"><a href="/build/building-studio" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/building-studio" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/building-studio" ><span class="devsite-nav-text" tooltip>Build and run your app in Android Studio</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Optimize your build</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/optimize-your-build" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/optimize-your-build" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/optimize-your-build" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/build/build-analyzer" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/build-analyzer" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/build-analyzer" ><span class="devsite-nav-text" tooltip>Troubleshoot build performance</span></a></li><li class="devsite-nav-item"><a href="/build/profile-your-build" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/profile-your-build" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/profile-your-build" ><span class="devsite-nav-text" tooltip>Profile your build</span></a></li><li class="devsite-nav-item"><a href="/build/shrink-code" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/shrink-code" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/shrink-code" ><span class="devsite-nav-text" tooltip>Shrink your app</span></a></li><li class="devsite-nav-item"><a href="/build/kotlin-support" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/kotlin-support" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/kotlin-support" ><span class="devsite-nav-text" tooltip>D8 and R8 compiler version compatibility</span></a></li><li class="devsite-nav-item"><a href="/build/multidex" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/multidex" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/multidex" ><span class="devsite-nav-text" tooltip>Enable multidex</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Extend your build</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/extend-agp" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/extend-agp" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/extend-agp" ><span class="devsite-nav-text" tooltip>Write Gradle plugins</span></a></li><li class="devsite-nav-item"><a href="/build/gradle-tips" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/gradle-tips" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/gradle-tips" ><span class="devsite-nav-text" tooltip>Gradle tips and recipes</span></a></li><li class="devsite-nav-item"><a href="/build/cxx-ninja" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/cxx-ninja" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/cxx-ninja" ><span class="devsite-nav-text" tooltip>Integrate a custom C/C++ build system</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Publish your library</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/publish-library" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/publish-library" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/publish-library" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/build/publish-library/prep-lib-release" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/publish-library/prep-lib-release" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/publish-library/prep-lib-release" ><span class="devsite-nav-text" tooltip>Prepare your library for release</span></a></li><li class="devsite-nav-item"><a href="/build/publish-library/configure-pub-variants" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/publish-library/configure-pub-variants" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/publish-library/configure-pub-variants" ><span class="devsite-nav-text" tooltip>Configure publication variants</span></a></li><li class="devsite-nav-item"><a href="/build/publish-library/configure-test-fixtures" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/publish-library/configure-test-fixtures" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/publish-library/configure-test-fixtures" ><span class="devsite-nav-text" tooltip>Configure test fixtures for publication</span></a></li><li class="devsite-nav-item"><a href="/build/publish-library/upload-library" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/publish-library/upload-library" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/publish-library/upload-library" ><span class="devsite-nav-text" tooltip>Upload your library</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Migrate your build</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/migrate-to-kotlin-dsl" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/migrate-to-kotlin-dsl" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/migrate-to-kotlin-dsl" ><span class="devsite-nav-text" tooltip>Migrate to the Kotlin DSL</span></a></li><li class="devsite-nav-item"><a href="/build/migrate-to-catalogs" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/migrate-to-catalogs" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/migrate-to-catalogs" ><span class="devsite-nav-text" tooltip>Migrate to version catalogs</span></a></li><li class="devsite-nav-item"><a href="/build/migrate-to-ksp" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/migrate-to-ksp" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/migrate-to-ksp" ><span class="devsite-nav-text" tooltip>Migrate to Kotlin Symbol Processing</span></a></li></ul></div></li> <li class="devsite-nav-item devsite-nav-expandable devsite-nav-accordion"><div class="devsite-expandable-nav"> <a class="devsite-nav-toggle" aria-hidden="true"></a><div class="devsite-nav-title devsite-nav-title-no-path" tabindex="0" role="button"> <span class="devsite-nav-text" tooltip>Troubleshoot</span> </div><ul class="devsite-nav-section"><li class="devsite-nav-item"><a href="/build/troubleshoot" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/troubleshoot" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/troubleshoot" ><span class="devsite-nav-text" tooltip>Overview</span></a></li><li class="devsite-nav-item"><a href="/build/dependency-resolution-errors" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /build/dependency-resolution-errors" track-type="bookNav" track-name="click" track-metadata-eventdetail="/build/dependency-resolution-errors" ><span class="devsite-nav-text" tooltip>Debug dependency resolution errors</span></a></li></ul></div></li> <li class="devsite-nav-item"><a href="/reference/tools/gradle-api" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /reference/tools/gradle-api" track-type="bookNav" track-name="click" track-metadata-eventdetail="/reference/tools/gradle-api" ><span class="devsite-nav-text" tooltip>Android Gradle plugin API reference</span></a></li> </ul> <ul class="devsite-nav-list" menu="Essentials" aria-label="Side menu" hidden> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Gemini in Android Studio </span> </span> </li> <li class="devsite-nav-item"> <a href="/gemini-in-android" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Learn more" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Learn more </span> </a> </li> <li class="devsite-nav-item"> <a href="/studio" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Get Android Studio" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Get Android Studio </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Get started </span> </span> </li> <li class="devsite-nav-item"> <a href="/get-started/overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Hello world" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Hello world </span> </a> </li> <li class="devsite-nav-item"> <a href="/courses" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Training courses" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Training courses </span> </a> </li> <li class="devsite-nav-item"> <a href="/get-started/codelabs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Tutorials" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Tutorials </span> </a> </li> <li class="devsite-nav-item"> <a href="/kotlin" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Kotlin for Android" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Kotlin for Android </span> </a> </li> <li class="devsite-nav-item"> <a href="https://play.google.com/console/about/guides/monetize/" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Monetization with Play ↗️" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Monetization with Play ↗️ </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Extend by device </span> </span> </li> <li class="devsite-nav-item"> <a href="/adaptive-apps" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Adaptive apps" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Adaptive apps </span> </a> </li> <li class="devsite-nav-item"> <a href="/wear" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Wear OS" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Wear OS </span> </a> </li> <li class="devsite-nav-item"> <a href="/cars" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android for Cars" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android for Cars </span> </a> </li> <li class="devsite-nav-item"> <a href="/tv" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android TV" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android TV </span> </a> </li> <li class="devsite-nav-item"> <a href="/chrome-os" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: ChromeOS" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > ChromeOS </span> </a> </li> <li class="devsite-nav-item"> <a href="/multi-device-development" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cross-device SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cross-device SDK </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Build by category </span> </span> </li> <li class="devsite-nav-item"> <a href="/games" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Games" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Games </span> </a> </li> <li class="devsite-nav-item"> <a href="/media" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Camera & Media" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Camera & Media </span> </a> </li> <li class="devsite-nav-item"> <a href="/social-and-messaging" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Social & messaging" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Social & messaging </span> </a> </li> <li class="devsite-nav-item"> <a href="/health-and-fitness" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Health & Fitness" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Health & Fitness </span> </a> </li> <li class="devsite-nav-item"> <a href="/productivity" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Productivity" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Productivity </span> </a> </li> <li class="devsite-nav-item"> <a href="/work/overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Enterprise apps" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Enterprise apps </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Get the latest </span> </span> </li> <li class="devsite-nav-item"> <a href="/latest-updates" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Latest updates" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Latest updates </span> </a> </li> <li class="devsite-nav-item"> <a href="/latest-updates/experimental" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Experimental updates" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Experimental updates </span> </a> </li> <li class="devsite-nav-item"> <a href="/studio/preview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android Studio preview" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android Studio preview </span> </a> </li> <li class="devsite-nav-item"> <a href="/jetpack/androidx/versions" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Jetpack & Compose libraries" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Jetpack & Compose libraries </span> </a> </li> <li class="devsite-nav-item"> <a href="/training/wearables/versions/4" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Wear OS preview" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Wear OS preview </span> </a> </li> <li class="devsite-nav-item"> <a href="/design-for-safety/privacy-sandbox" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Privacy Sandbox" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Privacy Sandbox </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Design & Plan" aria-label="Side menu" hidden> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > UI Design </span> </span> </li> <li class="devsite-nav-item"> <a href="/design/ui" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Design for Android" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Design for Android </span> </a> </li> <li class="devsite-nav-item"> <a href="/design/ui/mobile" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Mobile" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Mobile </span> </a> </li> <li class="devsite-nav-item"> <a href="/design/ui/large-screens" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Large screens (e.g., tablets)" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Large screens (e.g., tablets) </span> </a> </li> <li class="devsite-nav-item"> <a href="/design/ui/widget" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Widgets" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Widgets </span> </a> </li> <li class="devsite-nav-item"> <a href="/design/ui/wear" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Wear OS" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Wear OS </span> </a> </li> <li class="devsite-nav-item"> <a href="/design/ui/tv" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android TV" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android TV </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Architecture </span> </span> </li> <li class="devsite-nav-item"> <a href="/topic/architecture/intro" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Introduction" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Introduction </span> </a> </li> <li class="devsite-nav-item"> <a href="/topic/libraries/view-binding" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Libraries" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Libraries </span> </a> </li> <li class="devsite-nav-item"> <a href="/guide/navigation/navigation-principles" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Navigation" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Navigation </span> </a> </li> <li class="devsite-nav-item"> <a href="/topic/modularization" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Modularization" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Modularization </span> </a> </li> <li class="devsite-nav-item"> <a href="/training/testing/fundamentals" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Testing" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Testing </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Quality </span> </span> </li> <li class="devsite-nav-item"> <a href="/quality" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Overview" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Overview </span> </a> </li> <li class="devsite-nav-item"> <a href="/quality/core-value" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Core value" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Core value </span> </a> </li> <li class="devsite-nav-item"> <a href="/quality/user-experience" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: User experience" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > User experience </span> </a> </li> <li class="devsite-nav-item"> <a href="/quality/technical" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Technical quality" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Technical quality </span> </a> </li> <li class="devsite-nav-item"> <a href="/quality/privacy-and-security" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Security" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Security </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Security </span> </span> </li> <li class="devsite-nav-item"> <a href="/security" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Overview" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Overview </span> </a> </li> <li class="devsite-nav-item"> <a href="/privacy-and-security/about" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Privacy" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Privacy </span> </a> </li> <li class="devsite-nav-item"> <a href="/identity" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Identity" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Identity </span> </a> </li> <li class="devsite-nav-item"> <a href="/security/fraud-prevention" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Fraud prevention" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Fraud prevention </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Build for Billions </span> </span> </li> <li class="devsite-nav-item"> <a href="/build-for-billions" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Overview" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Overview </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs/quality-guidelines/build-for-billions" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: About new markets" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > About new markets </span> </a> </li> <li class="devsite-nav-item"> <a href="/guide/topics/androidgo" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android (Go edition)" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android (Go edition) </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Develop" aria-label="Side menu" hidden> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Build AI experiences </span> </span> </li> <li class="devsite-nav-item"> <a href="/ai" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Get started" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Get started </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Core areas </span> </span> </li> <li class="devsite-nav-item"> <a href="/samples" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Samples" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Samples </span> </a> </li> <li class="devsite-nav-item"> <a href="/quick-guides" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Try Quick Guidesᵇᵉᵗᵃ" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Try Quick Guidesᵇᵉᵗᵃ </span> </a> </li> <li class="devsite-nav-item"> <a href="/develop/ui" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: User interfaces" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > User interfaces </span> </a> </li> <li class="devsite-nav-item"> <a href="/guide/topics/permissions/overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Permissions" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Permissions </span> </a> </li> <li class="devsite-nav-item"> <a href="/develop/background-work" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Background work" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Background work </span> </a> </li> <li class="devsite-nav-item"> <a href="/guide/topics/data" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Data and files" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Data and files </span> </a> </li> <li class="devsite-nav-item"> <a href="/develop#core-areas" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: All core areas ⤵️" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > All core areas ⤵️ </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Tools and workflow </span> </span> </li> <li class="devsite-nav-item"> <a href="/studio/write" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Write and debug code" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Write and debug code </span> </a> </li> <li class="devsite-nav-item"> <a href="/build/gradle-build-overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Build projects" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Build projects </span> </a> </li> <li class="devsite-nav-item"> <a href="/training/testing" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Test your app" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Test your app </span> </a> </li> <li class="devsite-nav-item"> <a href="/topic/performance/overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Performance" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Performance </span> </a> </li> <li class="devsite-nav-item"> <a href="/tools" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Command-line tools" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Command-line tools </span> </a> </li> <li class="devsite-nav-item"> <a href="/reference/tools/gradle-api" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Gradle plugin API" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Gradle plugin API </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Device tech </span> </span> </li> <li class="devsite-nav-item"> <a href="/guide/topics/large-screens/get-started-with-large-screens" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Large screens (e.g., tablets)" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Large screens (e.g., tablets) </span> </a> </li> <li class="devsite-nav-item"> <a href="/training/wearables" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Wear OS" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Wear OS </span> </a> </li> <li class="devsite-nav-item"> <a href="/health-and-fitness/guides" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android Health" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android Health </span> </a> </li> <li class="devsite-nav-item"> <a href="/guide/topics/connectivity/cross-device-sdk/overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cross-device SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cross-device SDK </span> </a> </li> <li class="devsite-nav-item"> <a href="/training/cars" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android for Cars" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android for Cars </span> </a> </li> <li class="devsite-nav-item"> <a href="/training/tv" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android TV" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android TV </span> </a> </li> <li class="devsite-nav-item"> <a href="/chrome-os/intro" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: ChromeOS" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > ChromeOS </span> </a> </li> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Libraries </span> </span> </li> <li class="devsite-nav-item"> <a href="/reference/packages" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Android platform" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Android platform </span> </a> </li> <li class="devsite-nav-item"> <a href="/jetpack/androidx/explorer" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Jetpack libraries" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Jetpack libraries </span> </a> </li> <li class="devsite-nav-item"> <a href="/jetpack/androidx/releases/compose" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Compose libraries" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Compose libraries </span> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.google.com/android/reference/packages" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Play services ↗️" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Play services ↗️ </span> </a> </li> <li class="devsite-nav-item"> <a href="https://play.google.com/sdks" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Play SDK index ↗️" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Play SDK index ↗️ </span> </a> </li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav has-sidebar > <div class="devsite-sidebar"> <div class="devsite-sidebar-content"> <devsite-toc class="devsite-nav" role="navigation" aria-label="On this page" depth="2" scrollbars ></devsite-toc> <devsite-recommendations-sidebar class="nocontent devsite-nav"> </devsite-recommendations-sidebar> </div> </div> <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://developer.android.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Android Developers" > Android Developers </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developer.android.com/develop" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="" > Develop </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developer.android.com/studio" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="Android Studio" > Android Studio </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developer.android.com/build/gradle-build-overview" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="4" track-type="globalNav" track-name="breadcrumb" track-metadata-position="4" track-metadata-eventdetail="" > Android Gradle Plugin </a> </li> </ul> <devsite-thumb-rating position="header"> </devsite-thumb-rating> </div> <h1 class="devsite-page-title" tabindex="-1"> Configure your build </h1> <devsite-feature-tooltip ack-key="AckCollectionsBookmarkTooltipDismiss" analytics-category="Site-Wide Custom Events" analytics-action-show="Callout Profile displayed" analytics-action-close="Callout Profile dismissed" analytics-label="Create Collection Callout" class="devsite-page-bookmark-tooltip nocontent" dismiss-button="true" id="devsite-collections-dropdown" dismiss-button-text="Dismiss" close-button-text="Got it"> <devsite-bookmark></devsite-bookmark> <span slot="popout-heading"> Stay organized with collections </span> <span slot="popout-contents"> Save and categorize content based on your preferences. </span> </devsite-feature-tooltip> <div class="devsite-page-title-meta"><devsite-view-release-notes></devsite-view-release-notes></div> <devsite-toc class="devsite-nav" depth="2" devsite-toc-embedded > </devsite-toc> <devsite-recommendations-dropdown class="nocontent"></devsite-recommendations-dropdown> <div class="devsite-article-body clearfix "> <p>The Android build system compiles app resources and source code and packages them into APKs or Android App Bundles that you can test, deploy, sign, and distribute.</p> <p>In <a href="/studio/build/gradle-build-overview">Gradle build overview</a> and <a href="/studio/build/android-build-structure">Android build structure</a>, we discussed build concepts and the structure of an Android app. Now it's time to configure the build.</p> <h2 id="build-config" data-text="Android build glossary" tabindex="-1">Android build glossary</h2> <p> Gradle and the Android Gradle plugin help you configure the following aspects of your build: </p> <dl> <dt> <em>Build types</em> </dt> <dd> <p>Build types define certain properties that Gradle uses when building and packaging your app. Build types are typically configured for different stages of your development lifecycle.</p> <p>For example, the debug build type enables debug options and signs the app with the debug key, while the release build type may shrink, obfuscate, and sign your app with a release key for distribution.</p> <p>You must define at least one build type to build your app. Android Studio creates the debug and release build types by default. To start customizing packaging settings for your app, learn how to <a href="/studio/build/build-variants#build-types">configure build types</a>.</p> </dd> <dt> <em>Product flavors</em> </dt> <dd> Product flavors represent different versions of your app that you can release to users, such as free and paid versions. You can customize product flavors to use different code and resources while sharing and reusing the parts that are common to all versions of your app. Product flavors are optional, and you must create them manually. To start creating different versions of your app, learn how to <a href="/studio/build/build-variants#product-flavors">configure product flavors</a>. </dd> <dt> <em>Build variants</em> </dt> <dd> A build variant is a cross-product of build type and product flavor and is the configuration Gradle uses to build your app. Using build variants, you can build the debug version of your product flavors during development and signed release versions of your product flavors for distribution. Although you don't configure build variants directly, you configure the build types and product flavors that form them. Creating additional build types or product flavors also creates additional build variants. To learn how to create and manage build variants, read the <a href="/studio/build/build-variants">Configure build variants</a> overview. </dd> <dt> <em>Manifest entries</em> </dt> <dd> You can specify values for some properties of the manifest file in the build variant configuration. These build values override the existing values in the manifest file. This is useful if you want to generate multiple variants of your app with a different application name, minimum SDK version, or target SDK version. When multiple manifests are present, the manifest merger tool <a href="/studio/build/manage-manifests#merge-manifests"> merges manifest settings</a>. </dd> <dt> <em>Dependencies</em> </dt> <dd> The build system manages project dependencies from your local file system and from remote repositories. This means you don't have to manually search, download, and copy binary packages of your dependencies into your project directory. To find out more, see <a href="/studio/build/dependencies">Add build dependencies</a>. </dd> <dt> <em>Signing</em> </dt> <dd> The build system lets you specify signing settings in the build configuration, and it can automatically sign your app during the build process. The build system signs the debug version with a default key and certificate using known credentials to avoid a password prompt at build time. The build system does not sign the release version unless you explicitly define a signing configuration for this build. If you don't have a release key, you can generate one as described in <a href="/studio/publish/app-signing">Sign your app</a>. Signed release builds are required for distributing apps through most app stores. </dd> <dt> <em>Code and resource shrinking</em> </dt> <dd> The build system lets you specify a different ProGuard rules file for each build variant. When building your app, the build system applies the appropriate set of rules to <a href="/studio/build/shrink-code">shrink your code and resources</a> using its built-in shrinking tools, such as R8. Shrinking your code and resources can help reduce your APK or AAB size. </dd> <dt> <em>Multiple APK support</em> </dt> <dd> The build system lets you automatically build different APKs that each contain only the code and resources needed for a specific screen density or Application Binary Interface (ABI). For more information see <a href="/studio/build/configure-apk-splits"> Build multiple APKs</a>. However, releasing a single AAB is the recommended approach, as it offers splitting by language in addition to screen density and ABI, while avoiding the need to upload multiple artifacts to Google Play. All new apps submitted after August 2021 are required to use AABs. </dd> </dl> <h2 id="java-overview" data-text="Java versions in Android builds" tabindex="-1">Java versions in Android builds</h2> <p>Whether your source code is written in Java, Kotlin, or both, there are several places you must choose a JDK or Java language version for your build. See <a href="/build/jdks">Java versions in Android builds</a> for details.</p> <h2 id="build-files" data-text="Build configuration files" tabindex="-1">Build configuration files</h2> <p>Creating custom build configurations requires you to make changes to one or more build configuration files. These plain-text files use a domain-specific language (DSL) to describe and manipulate the build logic using <a href="https://kotlinlang.org/docs/command-line.html#run-scripts" class="external">Kotlin script</a>, which is a flavor of the Kotlin language. You can also use <a href="http://groovy-lang.org" class="external">Groovy</a>, which is a dynamic language for the Java Virtual Machine (JVM), to configure your builds.</p> <p>You don't need to know Kotlin script or Groovy to start configuring your build because the Android Gradle plugin introduces most of the DSL elements you need. To learn more about the Android Gradle plugin DSL, read the <a href="/reference/tools/gradle-api">DSL reference documentation</a>. Kotlin script also relies on the underlying <a href="https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotlin_dsl" class="external">Gradle Kotlin DSL</a> </p> <p>When starting a new project, Android Studio automatically creates some of these files for you and populates them based on sensible defaults. For an overview of the created files, see <a href="/studio/build/android-build-structure">Android build structure</a>.</p> <h3 id="wrapper-file" data-text="The Gradle Wrapper file" tabindex="-1">The Gradle Wrapper file</h3> <p>The Gradle wrapper (<code translate="no" dir="ltr">gradlew</code>) is a small application included with your source code that downloads and launches Gradle itself. This creates more-consistent build execution. Developers download the application source and run <code translate="no" dir="ltr">gradlew</code>. This downloads the required Gradle distribution, and launches Gradle to build your application.</p> <p>The <code translate="no" dir="ltr">gradle/wrapper/gradle-wrapper.properties</code> file contains a property, <code translate="no" dir="ltr">distributionUrl</code>, that describes which version of Gradle is used to run your build.</p> <aside class="tip"><strong>Tip:</strong><span> If simultaneously working on multiple projects, if possible, ensure that all of the projects use the same Gradle version. Otherwise, Gradle creates copies of the Gradle daemon for each Gradle version, in addition to separate copies for each <a href="/build/jdks#jdk-gradle">JDK used to run Gradle</a>. This increases memory and CPU usage, potentially slowing your builds or impacting other work on the machine.</span></aside><div></div><devsite-code><pre class="devsite-click-to-copy devsite-code-highlight" translate="no" dir="ltr" is-upgraded syntax="scdoc"><code translate="no" dir="ltr">distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/<strong>gradle-8.0-bin.zip</strong> zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists </code></pre></devsite-code> <h3 id="settings-file" data-text="The Gradle settings file" tabindex="-1">The Gradle settings file</h3> <p> The <code translate="no" dir="ltr">settings.gradle.kts</code> file (for the Kotlin DSL) or <code translate="no" dir="ltr">settings.gradle</code> file (for the Groovy DSL) is located in the root project directory. This settings file defines project-level repository settings and informs Gradle which modules it should include when building your app. Multi-module projects need to specify each module that should go into the final build. </p> <p>For most projects, the file looks like the following by default:</p> <div> <div class="ds-selector-tabs"><section><h3 class="two-line-tab" tab-label="settings.gradle.kts" id="kts" data-text="Kotlin" tabindex="-1">Kotlin</h3> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Kotlin"><span class="devsite-syntax-n">pluginManagement</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The pluginManagement.repositories block configures the</span> <span class="devsite-syntax-cm"> * repositories Gradle uses to search or download the Gradle plugins and</span> <span class="devsite-syntax-cm"> * their transitive dependencies. Gradle pre-configures support for remote</span> <span class="devsite-syntax-cm"> * repositories such as JCenter, Maven Central, and Ivy. You can also use</span> <span class="devsite-syntax-cm"> * local repositories or define your own remote repositories. Here we</span> <span class="devsite-syntax-cm"> * define the <a class="external=link" href="https://plugins.gradle.org/">Gradle Plugin Portal</a>, <a href="/studio/build/dependencies?agpversion=4.1&buildsystem=ndk-build#google-maven">Google's Maven repository</a>,</span> <span class="devsite-syntax-cm"> * and the <a class="external-link" href="https://search.maven.org/">Maven Central Repository</a> as the repositories Gradle should use to look for its</span> <span class="devsite-syntax-cm"> * dependencies.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">repositories</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gradlePluginPortal</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">mavenCentral</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-n">dependencyResolutionManagement</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The dependencyResolutionManagement.repositories</span> <span class="devsite-syntax-cm"> * block is where you configure the repositories and dependencies used by</span> <span class="devsite-syntax-cm"> * all modules in your project, such as libraries that you are using to</span> <span class="devsite-syntax-cm"> * create your application. However, you should configure module-specific</span> <span class="devsite-syntax-cm"> * dependencies in each module-level build.gradle file. For new projects,</span> <span class="devsite-syntax-cm"> * Android Studio includes Google's Maven repository and the Maven Central</span> <span class="devsite-syntax-cm"> * Repository by default, but it does not configure any dependencies (unless</span> <span class="devsite-syntax-cm"> * you select a template that requires some).</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">repositoriesMode</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">set</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">RepositoriesMode</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">FAIL_ON_PROJECT_REPOS</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">repositories</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">mavenCentral</span><span class="devsite-syntax-p">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-n">rootProject</span><span class="devsite-syntax-p">.</span><span class="devsite-syntax-na">name</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"My Application"</span> <span class="devsite-syntax-n">include</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">":app"</span><span class="devsite-syntax-p">)</span></pre></devsite-code> </section><section><h3 class="two-line-tab" tab-label="settings.gradle" id="groovy" data-text="Groovy" tabindex="-1">Groovy</h3> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Groovy"><span class="devsite-syntax-n">pluginManagement</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The pluginManagement.repositories block configures the</span> <span class="devsite-syntax-cm"> * repositories Gradle uses to search or download the Gradle plugins and</span> <span class="devsite-syntax-cm"> * their transitive dependencies. Gradle pre-configures support for remote</span> <span class="devsite-syntax-cm"> * repositories such as JCenter, Maven Central, and Ivy. You can also use</span> <span class="devsite-syntax-cm"> * local repositories or define your own remote repositories. Here we</span> <span class="devsite-syntax-cm"> * define the <a class="external=link" href="https://plugins.gradle.org/">Gradle Plugin Portal</a>, <a href="/studio/build/dependencies?agpversion=4.1&buildsystem=ndk-build#google-maven">Google's Maven repository</a>,</span> <span class="devsite-syntax-cm"> * and the <a class="external-link" href="https://search.maven.org/">Maven Central Repository</a> as the repositories Gradle should use to look for its</span> <span class="devsite-syntax-cm"> * dependencies.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">repositories</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">gradlePluginPortal</span><span class="devsite-syntax-o">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-o">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">mavenCentral</span><span class="devsite-syntax-o">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-o">}</span> <span class="devsite-syntax-n">dependencyResolutionManagement</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The dependencyResolutionManagement.repositories</span> <span class="devsite-syntax-cm"> * block is where you configure the repositories and dependencies used by</span> <span class="devsite-syntax-cm"> * all modules in your project, such as libraries that you are using to</span> <span class="devsite-syntax-cm"> * create your application. However, you should configure module-specific</span> <span class="devsite-syntax-cm"> * dependencies in each module-level build.gradle file. For new projects,</span> <span class="devsite-syntax-cm"> * Android Studio includes Google's Maven repository and the Maven Central</span> <span class="devsite-syntax-cm"> * Repository by default, but it does not configure any dependencies (unless</span> <span class="devsite-syntax-cm"> * you select a template that requires some).</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">repositoriesMode</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-na">set</span><span class="devsite-syntax-o">(</span><span class="devsite-syntax-n">RepositoriesMode</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-na">FAIL_ON_PROJECT_REPOS</span><span class="devsite-syntax-o">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">repositories</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">google</span><span class="devsite-syntax-o">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">mavenCentral</span><span class="devsite-syntax-o">()</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-o">}</span> <span class="devsite-syntax-n">rootProject</span><span class="devsite-syntax-o">.</span><span class="devsite-syntax-na">name</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"My Application"</span> <span class="devsite-syntax-n">include</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">':app'</span></pre></devsite-code> </section></div> </div> <h3 id="top-level" data-text="The top-level build file" tabindex="-1">The top-level build file</h3> <p> The top-level <code translate="no" dir="ltr">build.gradle.kts</code> file (for the Kotlin DSL) or <code translate="no" dir="ltr">build.gradle</code> file (for the Groovy DSL) is located in the root project directory. It typically defines the common versions of plugins used by modules in your project.</p> <p> The following code sample describes the default settings and DSL elements in the top-level build script after creating a new project: </p> <div> <div class="ds-selector-tabs"><section><h3 class="two-line-tab" tab-label="build.gradle.kts" id="kts" data-text="Kotlin" tabindex="-1">Kotlin</h3> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Kotlin"><span class="devsite-syntax-n">plugins</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * Use `apply false` in the top-level build.gradle file to add a Gradle</span> <span class="devsite-syntax-cm"> * plugin as a build dependency but not apply it to the current (root)</span> <span class="devsite-syntax-cm"> * project. Don't use `apply false` in sub-projects. For more information,</span> <span class="devsite-syntax-cm"> * see <a class="external-link" href="https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl">Applying external plugins with same version to subprojects</a>.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"com.android.application"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">version</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"8.7.0"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apply</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"com.android.library"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">version</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"8.7.0"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apply</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"org.jetbrains.kotlin.android"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">version</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"2.0.20"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apply</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-p">}</span></pre></devsite-code> </section><section><h3 class="two-line-tab" tab-label="build.gradle" id="groovy" data-text="Groovy" tabindex="-1">Groovy</h3> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Groovy"><span class="devsite-syntax-n">plugins</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * Use `apply false` in the top-level build.gradle file to add a Gradle</span> <span class="devsite-syntax-cm"> * plugin as a build dependency but not apply it to the current (root)</span> <span class="devsite-syntax-cm"> * project. Don't use `apply false` in sub-projects. For more information,</span> <span class="devsite-syntax-cm"> * see <a class="external-link" href="https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl">Applying external plugins with same version to subprojects</a>.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.android.application'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">version</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'8.7.0'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apply</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.android.library'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">version</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'8.7.0'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apply</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'org.jetbrains.kotlin.android'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">version</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'2.0.20'</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">apply</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">false</span> <span class="devsite-syntax-o">}</span> </section></div></pre></devsite-code> </div> <h3 id="module-level" data-text="The module-level build file" tabindex="-1">The module-level build file</h3> <p> The module-level <code translate="no" dir="ltr">build.gradle.kts</code> (for the Kotlin DSL) or <code translate="no" dir="ltr">build.gradle</code> file (for the Groovy DSL) is located in each <code translate="no" dir="ltr"><var translate="no">project</var>/<var translate="no">module</var>/</code> directory. It lets you configure build settings for the specific module it is located in. Configuring these build settings lets you provide custom packaging options, such as additional build types and product flavors, and override settings in the <code translate="no" dir="ltr">main/</code> app manifest or top-level build script. </p> <h4 id="android_sdk_settings" data-text="Android SDK Settings" tabindex="-1">Android SDK Settings</h4> <p>The module-level build file for your application includes settings that indicate Android SDK versions used when compiling, selecting platform behaviors, and specifying the minimum version that your application runs on.</p> <figure> <img class="invert" src="/static/images/build/android-sdks.svg" alt="Overview of SDK specifications in a Gradle build"> <figcaption class="img-caption"> <strong>Figure 1.</strong> Android SDKs in a build </figcaption> </figure> <dl> <dt> <em><code translate="no" dir="ltr">compileSdk</code></em> </dt> <dd> <p> The <code translate="no" dir="ltr">compileSdk</code> determines which Android and Java APIs are available when compiling your source code. To use the latest Android features, use the latest Android SDK when compiling. </p> <p> Some Android platform APIs might not be available in older API levels. You can <a href="/training/basics/supporting-devices/platforms#version-codes"> conditionally guard use of newer features</a> or use <a href="/jetpack/androidx/releases/appcompat"> AndroidX compatibility libraries</a> to use newer features with lower Android API levels. </p> <p> Each Android SDK provides a subset of Java APIs for use in your application. The table at <a href="/build/jdks#compileSdk"> Which Java APIs can I use in my Java or Kotlin source code</a> shows which Java API level is available based on the Android SDK version. The newer Java APIs are supported on earlier versions of Android through <a href="/studio/write/java8-support">desugaring</a>, which must be enabled in your build. </p> <p> Android Studio displays warnings if your <code translate="no" dir="ltr">compileSdk</code> conflicts with the current version of Android Studio, AGP, or your project's library dependency requirements. </p> </dd> <dt> <em><code translate="no" dir="ltr">minSdk</code></em> </dt> <dd> <p> The <code translate="no" dir="ltr">minSdk</code> specifies the lowest version of Android that you want your app to support. Setting <code translate="no" dir="ltr">minSdk</code> restricts which devices can install your app. </p> <p> Supporting lower versions of Android might require more conditional checks in your code or more use of AndroidX compatibility libraries. You should weigh the maintenance cost of supporting lower versions against the percentage of users that are still using those lower versions. See the version chart in the <strong>New project wizard</strong> of Android Studio for the current version-use percentages. </p> <p> When editing your code in Android Studio or running checks during your build, lint will warn about APIs that you use that are not available in the <code translate="no" dir="ltr">minSdk</code>. You should fix these by <a href="/training/basics/supporting-devices/platforms#version-codes"> making newer features conditional</a> or by using <a href="/jetpack/androidx/releases/appcompat"> <code translate="no" dir="ltr">Appcompat</code></a> for backward compatibility. </p> </dd> <dt> <em><code translate="no" dir="ltr">targetSdk</code></em> </dt> <dd> <p> The <code translate="no" dir="ltr">targetSdk</code> serves two purposes: </p> <ol> <li>It sets runtime behavior of your application.</li> <li>It attests which version of Android you've tested against.</li> </ol> <p> If you run on a device that's using a higher version of Android than your <code translate="no" dir="ltr">targetSdk</code>, Android runs your app in a compatibility mode that behaves similarly to the lower version indicated in your <code translate="no" dir="ltr">targetSdk</code>. For example, when API 23 introduced the runtime permissions model, not all apps were ready to immediately adopt it. By setting <code translate="no" dir="ltr">targetSdk</code> to 22, those apps could run on API 23 devices without using runtime permissions, and could use features included in the latest <code translate="no" dir="ltr">compileSdk</code> version. Google Play distribution policy enforces <a href="/google/play/requirements/target-sdk"> additional policies on target API level</a>. </p> <p> The value of <code translate="no" dir="ltr">targetSdk</code> must be less than or equal to that of <code translate="no" dir="ltr">compileSdk</code>. </p> </dd> </dl> <div class="note"> <p> <b>Note:</b> The values of <code translate="no" dir="ltr">compileSdk</code> and <code translate="no" dir="ltr">targetSdk</code> don't need to be the same. Keep the following basic principles in mind: </p> <ul> <li><code translate="no" dir="ltr">compileSdk</code> gives you access to new APIs</li> <li><code translate="no" dir="ltr">targetSdk</code> sets the runtime behavior of your app</li> <li><code translate="no" dir="ltr">targetSdk</code> must be less than or equal to <code translate="no" dir="ltr">compileSdk</code></li> </ul> </div> <h4 id="sample_app-module_build_script" data-text="Sample app-module build script" tabindex="-1">Sample app-module build script</h4> <p> This sample Android app module build script outlines some of the basic DSL elements and settings: </p> <div> <div class="ds-selector-tabs"><section><h3 class="two-line-tab" tab-label="build.gradle.kts" id="kts" data-text="Kotlin" tabindex="-1">Kotlin</h3> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Kotlin"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The first section in the build configuration applies the Android Gradle plugin</span> <span class="devsite-syntax-cm"> * to this build and makes the android block available to specify</span> <span class="devsite-syntax-cm"> * Android-specific build options.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">plugins</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"com.android.application"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * Locate (and possibly download) a JDK used to build your kotlin</span> <span class="devsite-syntax-cm"> * source code. This also acts as a default for sourceCompatibility,</span> <span class="devsite-syntax-cm"> * targetCompatibility and jvmTarget. Note that this does not affect which JDK</span> <span class="devsite-syntax-cm"> * is used to run the Gradle build itself, and does not need to take into</span> <span class="devsite-syntax-cm"> * account the JDK version required by Gradle plugins (such as the</span> <span class="devsite-syntax-cm"> * Android Gradle Plugin)</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">kotlin</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">jvmToolchain</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-m">11</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The android block is where you configure all your Android-specific</span> <span class="devsite-syntax-cm"> * build options.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">android</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The app's <a href="/studio/build/configure-app-module#set-namespace">namespace</a>. Used primarily to access app resources.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">namespace</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"com.example.myapp"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * compileSdk specifies the Android API level Gradle should use to</span> <span class="devsite-syntax-cm"> * compile your app. This means your app can use the API features included in</span> <span class="devsite-syntax-cm"> * this API level and lower.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">compileSdk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-m">33</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The defaultConfig block encapsulates default settings and entries for all</span> <span class="devsite-syntax-cm"> * build variants and can override some attributes in main/AndroidManifest.xml</span> <span class="devsite-syntax-cm"> * dynamically from the build system. You can configure product flavors to override</span> <span class="devsite-syntax-cm"> * these values for different versions of your app.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">defaultConfig</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Uniquely identifies the package for publishing.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">applicationId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"com.example.myapp"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Defines the minimum API level required to run the app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">minSdk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-m">21</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Specifies the API level used to test the app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">targetSdk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-m">33</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Defines the version number of your app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">versionCode</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-m">1</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Defines a user-friendly version name for your app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">versionName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"1.0"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The buildTypes block is where you can configure multiple <a href="/studio/build/build-variants#build-types">build types</a>.</span> <span class="devsite-syntax-cm"> * By default, the build system defines two build types: debug and release. The</span> <span class="devsite-syntax-cm"> * debug build type is not explicitly shown in the default build configuration,</span> <span class="devsite-syntax-cm"> * but it includes debugging tools and is signed with the debug key. The release</span> <span class="devsite-syntax-cm"> * build type applies ProGuard settings and is not signed by default.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">buildTypes</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * By default, Android Studio configures the release build type to enable code</span> <span class="devsite-syntax-cm"> * shrinking, using minifyEnabled, and specifies the default ProGuard rules file.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getByName</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"release"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">isMinifyEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Enables code shrinking for the release build type.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">proguardFiles</span><span class="devsite-syntax-p">(</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getDefaultProguardFile</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"proguard-android.txt"</span><span class="devsite-syntax-p">),</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"proguard-rules.pro"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The productFlavors block is where you can configure multiple <a href="/studio/build/build-variants#product-flavors">product flavors</a>.</span> <span class="devsite-syntax-cm"> * This lets you create different versions of your app that can</span> <span class="devsite-syntax-cm"> * override the defaultConfig block with their own settings. Product flavors</span> <span class="devsite-syntax-cm"> * are optional, and the build system does not create them by default.</span> <span class="devsite-syntax-cm"> *</span> <span class="devsite-syntax-cm"> * This example creates a free and paid product flavor. Each product flavor</span> <span class="devsite-syntax-cm"> * then specifies its own application ID, so that they can exist on the Google</span> <span class="devsite-syntax-cm"> * Play Store or an Android device simultaneously.</span> <span class="devsite-syntax-cm"> *</span> <span class="devsite-syntax-cm"> * If you declare product flavors, you must also declare flavor dimensions</span> <span class="devsite-syntax-cm"> * and assign each flavor to a flavor dimension.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><a href="/reference/tools/gradle-api/current/com/android/build/api/dsl/ProductFlavor#dimension"><span class="devsite-syntax-n">flavorDimensions</span></a><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">+=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"tier"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">productFlavors</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">create</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"free"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">dimension</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"tier"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">applicationId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"com.example.myapp.free"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">create</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"paid"</span><span class="devsite-syntax-p">)</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">dimension</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"tier"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">applicationId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">=</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"com.example.myapp.paid"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * To override source and target compatibility (if different from the</span> <span class="devsite-syntax-cm"> * toolchain JDK version), add the following. All of these</span> <span class="devsite-syntax-cm"> * default to the same value as kotlin.jvmToolchain. If you're using the</span> <span class="devsite-syntax-cm"> * same version for these values and kotlin.jvmToolchain, you can</span> <span class="devsite-syntax-cm"> * remove these blocks.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//compileOptions {</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// sourceCompatibility = JavaVersion.VERSION_11</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// targetCompatibility = JavaVersion.VERSION_11</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//kotlinOptions {</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// jvmTarget = "11"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//}</span> <span class="devsite-syntax-p">}</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The dependencies block in the module-level build configuration file</span> <span class="devsite-syntax-cm"> * specifies dependencies required to build only the module itself.</span> <span class="devsite-syntax-cm"> * To learn more, go to <a href="/studio/build/dependencies">Add build dependencies</a>.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">dependencies</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-p">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">implementation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">":lib"</span><span class="devsite-syntax-p">))</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">implementation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"androidx.appcompat:appcompat:1.7.0"</span><span class="devsite-syntax-p">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">implementation</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">fileTree</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-n">mapOf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"dir"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">to</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"libs"</span><span class="devsite-syntax-p">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s">"include"</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">to</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">listOf</span><span class="devsite-syntax-p">(</span><span class="devsite-syntax-s">"*.jar"</span><span class="devsite-syntax-p">))))</span> <span class="devsite-syntax-p">}</span></pre></devsite-code> </section><section><h3 class="two-line-tab" tab-label="build.gradle" id="groovy" data-text="Groovy" tabindex="-1">Groovy</h3> <div></div><devsite-code><pre class="devsite-click-to-copy" translate="no" dir="ltr" is-upgraded syntax="Groovy"><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The first line in the build configuration applies the Android Gradle plugin</span> <span class="devsite-syntax-cm"> * to this build and makes the android block available to specify</span> <span class="devsite-syntax-cm"> * Android-specific build options.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">plugins</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">id</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.android.application'</span> <span class="devsite-syntax-o">}</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * Locate (and possibly download) a JDK used to build your kotlin</span> <span class="devsite-syntax-cm"> * source code. This also acts as a default for sourceCompatibility,</span> <span class="devsite-syntax-cm"> * targetCompatibility and jvmTarget. Note that this does not affect which JDK</span> <span class="devsite-syntax-cm"> * is used to run the Gradle build itself, and does not need to take into</span> <span class="devsite-syntax-cm"> * account the JDK version required by Gradle plugins (such as the</span> <span class="devsite-syntax-cm"> * Android Gradle Plugin)</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">kotlin</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">jvmToolchain</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">11</span> <span class="devsite-syntax-o">}</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The android block is where you configure all your Android-specific</span> <span class="devsite-syntax-cm"> * build options.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">android</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The app's <a href="/studio/build/configure-app-module#set-namespace">namespace</a>. Used primarily to access app resources.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">namespace</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.example.myapp'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * compileSdk specifies the Android API level Gradle should use to</span> <span class="devsite-syntax-cm"> * compile your app. This means your app can use the API features included in</span> <span class="devsite-syntax-cm"> * this API level and lower.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">compileSdk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">33</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The defaultConfig block encapsulates default settings and entries for all</span> <span class="devsite-syntax-cm"> * build variants and can override some attributes in main/AndroidManifest.xml</span> <span class="devsite-syntax-cm"> * dynamically from the build system. You can configure product flavors to override</span> <span class="devsite-syntax-cm"> * these values for different versions of your app.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">defaultConfig</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Uniquely identifies the package for publishing.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">applicationId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.example.myapp'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Defines the minimum API level required to run the app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">minSdk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">21</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Specifies the API level used to test the app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">targetSdk</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">33</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Defines the version number of your app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">versionCode</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-mi">1</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Defines a user-friendly version name for your app.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">versionName</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"1.0"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The buildTypes block is where you can configure multiple <a href="/studio/build/build-variants#build-types">build types</a>.</span> <span class="devsite-syntax-cm"> * By default, the build system defines two build types: debug and release. The</span> <span class="devsite-syntax-cm"> * debug build type is not explicitly shown in the default build configuration,</span> <span class="devsite-syntax-cm"> * but it includes debugging tools and is signed with the debug key. The release</span> <span class="devsite-syntax-cm"> * build type applies ProGuard settings and is not signed by default.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">buildTypes</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * By default, Android Studio configures the release build type to enable code</span> <span class="devsite-syntax-cm"> * shrinking, using minifyEnabled, and specifies the default ProGuard rules file.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">release</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">minifyEnabled</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-kc">true</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// Enables code shrinking for the release build type.</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">proguardFiles</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">getDefaultProguardFile</span><span class="devsite-syntax-o">(</span><span class="devsite-syntax-s1">'proguard-android.txt'</span><span class="devsite-syntax-o">),</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'proguard-rules.pro'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The productFlavors block is where you can configure multiple <a href="/studio/build/build-variants#product-flavors">product flavors</a>.</span> <span class="devsite-syntax-cm"> * This lets you create different versions of your app that can</span> <span class="devsite-syntax-cm"> * override the defaultConfig block with their own settings. Product flavors</span> <span class="devsite-syntax-cm"> * are optional, and the build system does not create them by default.</span> <span class="devsite-syntax-cm"> *</span> <span class="devsite-syntax-cm"> * This example creates a free and paid product flavor. Each product flavor</span> <span class="devsite-syntax-cm"> * then specifies its own application ID, so that they can exist on the Google</span> <span class="devsite-syntax-cm"> * Play Store or an Android device simultaneously.</span> <span class="devsite-syntax-cm"> *</span> <span class="devsite-syntax-cm"> * If you declare product flavors, you must also declare flavor dimensions</span> <span class="devsite-syntax-cm"> * and assign each flavor to a flavor dimension.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><a href="/reference/tools/gradle-api/current/com/android/build/api/dsl/ProductFlavor#dimension"><span class="devsite-syntax-n">flavorDimensions</span></a><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"tier"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">productFlavors</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">free</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">dimension</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"tier"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">applicationId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.example.myapp.free'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">paid</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">dimension</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s2">"tier"</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">applicationId</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'com.example.myapp.paid'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * To override source and target compatibility (if different from the</span> <span class="devsite-syntax-cm"> * tool chain JDK version), add the following. All of these</span> <span class="devsite-syntax-cm"> * default to the same value as kotlin.jvmToolchain. If you're using the</span> <span class="devsite-syntax-cm"> * same version for these values and kotlin.jvmToolchain, you can</span> <span class="devsite-syntax-cm"> * remove these blocks.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//compileOptions {</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// sourceCompatibility JavaVersion.VERSION_11</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// targetCompatibility JavaVersion.VERSION_11</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//}</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//kotlinOptions {</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">// jvmTarget = '11'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-c1">//}</span> <span class="devsite-syntax-o">}</span> <span class="devsite-syntax-cm">/**</span> <span class="devsite-syntax-cm"> * The dependencies block in the module-level build configuration file</span> <span class="devsite-syntax-cm"> * specifies dependencies required to build only the module itself.</span> <span class="devsite-syntax-cm"> * To learn more, go to <a href="/studio/build/dependencies">Add build dependencies</a>.</span> <span class="devsite-syntax-cm"> */</span> <span class="devsite-syntax-n">dependencies</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">{</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">implementation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">project</span><span class="devsite-syntax-o">(</span><span class="devsite-syntax-s2">":lib"</span><span class="devsite-syntax-o">)</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">implementation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'androidx.appcompat:appcompat:1.7.0'</span> <span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">implementation</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-n">fileTree</span><span class="devsite-syntax-o">(</span><span class="devsite-syntax-nl">dir:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-s1">'libs'</span><span class="devsite-syntax-o">,</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-nl">include:</span><span class="devsite-syntax-w"> </span><span class="devsite-syntax-o">[</span><span class="devsite-syntax-s1">'*.jar'</span><span class="devsite-syntax-o">])</span> <span class="devsite-syntax-o">}</span></pre></devsite-code> </section></div> </div> <h3 id="properties-files" data-text="Gradle properties files" tabindex="-1">Gradle properties files</h3> <p> Gradle also includes two properties files, located in your root project directory, that you can use to specify settings for the Gradle build toolkit itself: </p> <dl> <dt> <code translate="no" dir="ltr">gradle.properties</code> </dt> <dd> This is where you can configure project-wide Gradle settings, such as the Gradle daemon's maximum heap size. For more information, see <a href="https://docs.gradle.org/current/userguide/build_environment.html" class= "external-link">Build Environment</a>. </dd> <dt> <code translate="no" dir="ltr">local.properties</code> </dt> <dd> Configures local environment properties for the build system, including the following: <ul> <li><code translate="no" dir="ltr">ndk.dir</code> - Path to the NDK. This property has been deprecated. Any downloaded versions of the NDK are installed in the <code translate="no" dir="ltr">ndk</code> directory within the Android SDK directory.</li> <li><code translate="no" dir="ltr">sdk.dir</code> - Path to the Android SDK.</li> <li><code translate="no" dir="ltr">cmake.dir</code> - Path to CMake.</li> <li><code translate="no" dir="ltr">ndk.symlinkdir</code> - In Android Studio 3.5 and higher, creates a symlink to the NDK that can be shorter than the installed NDK path.</li> </ul> </dd> </dl> <aside class="caution"><strong>Caution:</strong><span> The <code translate="no" dir="ltr">local.properties</code> file is reserved for properties specific to the Android Gradle plugin. Putting your own values in this file can cause problems. If you need to define your own local properties, <a href="/studio/build/gradle-tips#remove-private-signing-information-from-your-project">create a separate properties file and manually load it</a>.</span></aside> <h3 id="remap-ndk" data-text="Remap the NDK to a shorter path (Windows only)" tabindex="-1">Remap the NDK to a shorter path (Windows only)</h3> <p>In Windows, tools in the installed NDK folder, such as <code translate="no" dir="ltr">ld.exe</code>, end up with long paths. The tools don't support long paths well.</p> <p>To create a shorter path, in <code translate="no" dir="ltr">local.properties</code>, set the property <code translate="no" dir="ltr">ndk.symlinkdir</code> to request that the Android Gradle plugin create a symlink to the NDK. The path of that symlink can be shorter than the existing NDK folder. For example, <code translate="no" dir="ltr">ndk.symlinkdir = C:\</code> results in the following symlink: <code translate="no" dir="ltr">C:\ndk\19.0.5232133</code></p> <h3 id="sync-files" data-text="Sync project with Gradle files" tabindex="-1">Sync project with Gradle files</h3> <p> When you make changes to the build configuration files in your project, Android Studio requires that you sync your project files so that it can import your build configuration changes and run some checks to make sure your configuration doesn't create build errors. </p> <p> To sync your project files, click <strong>Sync Now</strong> in the notification bar that appears when you make a change, as shown in figure 2, or click <strong>Sync Project</strong> <img src="/static/studio/images/buttons/toolbar-sync-gradle.png" alt="" class="inline-icon"> from the menu bar. If Android Studio finds any errors with your configuration — for example, your source code uses API features that are only available in an API level higher than your <code translate="no" dir="ltr">compileSdkVersion</code> — the <strong>Messages</strong> window describes the issue. </p> <figure> <img src="/static/images/tools/as-gradlesync.png" alt> <figcaption class="img-caption"> <strong>Figure 2.</strong> Sync the project with build configuration files in Android Studio. </figcaption> </figure> <h3 id="sourcesets" data-text="Source sets" tabindex="-1">Source sets</h3> <p> Android Studio logically groups source code and resources for each module into <em>source sets</em>. When you create a new module, Android Studio creates a <code translate="no" dir="ltr">main/</code> source set within the module. A module's <code translate="no" dir="ltr">main/</code> source set includes the code and resources used by all its build variants.</p> <p><p>Additional source set directories are optional, and Android Studio doesn't automatically create them for you when you configure new build variants. However, creating source sets, similar to <code translate="no" dir="ltr">main/</code>, helps organize files and resources that Gradle should only use when building certain versions of your app: </p></p> <dl> <dt> <code translate="no" dir="ltr">src/main/</code> </dt> <dd> This source set includes code and resources common to all build variants. </dd> <dt> <code translate="no" dir="ltr">src/<var translate="no">buildType</var>/</code> </dt> <dd> Create this source set to include code and resources only for a specific build type. </dd> <dt> <code translate="no" dir="ltr">src/<var translate="no">productFlavor</var>/</code> </dt> <dd> Create this source set to include code and resources only for a specific product flavor. <p class="note"> <b>Note:</b> If you configure your build to <a href="/studio/build/build-variants#flavor-dimensions">combine multiple product flavors</a>, you can create source set directories for each <em>combination</em> of product flavors between the flavor dimensions: <code translate="no" dir="ltr">src/<var translate="no">productFlavor1</var><var translate="no">ProductFlavor2</var>/</code>. </p> </dd> <dt> <code translate="no" dir="ltr">src/<var translate="no">productFlavorBuildType</var>/</code> </dt> <dd> Create this source set to include code and resources only for a specific build variant. </dd> </dl> <p> For example, to generate the "fullDebug" version of your app, the build system merges code, settings, and resources from following source sets: </p> <ul> <li> <code translate="no" dir="ltr">src/fullDebug/</code> (the build variant source set) </li> <li> <code translate="no" dir="ltr">src/debug/</code> (the build type source set) </li> <li> <code translate="no" dir="ltr">src/full/</code> (the product flavor source set) </li> <li> <code translate="no" dir="ltr">src/main/</code> (the main source set) </li> </ul> <p class="note"> <strong>Note:</strong> When you create a new file or directory in Android Studio, use the <strong>File > New</strong> menu options to create it for a specific source set. The source sets you can choose from are based on your build configurations, and Android Studio automatically creates the required directories if they don't already exist. </p> <p> If different source sets contain different versions of the same file, Gradle uses the following priority order when deciding which file to use. Source sets on the left override the files and settings of source sets to the right: </p> <blockquote> build variant > build type > product flavor > main source set > library dependencies </blockquote> <p> This allows Gradle to use files that are specific to the build variant you are trying to build while reusing activities, application logic, and resources that are common to other versions of your app.</p> <p><p>When <a href="/studio/build/manage-manifests#merge-manifests">merging multiple manifests</a>, Gradle uses the same priority order so each build variant can define different components or permissions in the final manifest. To learn more about creating custom source sets, read <a href="/studio/build/build-variants#sourcesets">Create source sets</a>. </p></p> <h2 id="version-catalogs" data-text="Version catalogs" tabindex="-1">Version catalogs</h2> <p>If your build contains multiple modules with common dependencies, or you have multiple independent projects with common dependencies, we recommend that you use a <a href="https://docs.gradle.org/current/userguide/platforms.html" class="external">version catalog or bill of materials (BOM)</a> to specify the common versions.</p> <h2 id="other-build-systems" data-text="Other build systems" tabindex="-1">Other build systems</h2> <p>Building Android apps with <a href="https://bazel.build/" class="external">Bazel</a> is possible but not officially supported. Android Studio does not officially support Bazel projects.</p> <p>To better understand the current limitations of building with Bazel, see the <a href="https://github.com/bazelbuild/bazel/issues?q=is%3Aissue+is%3Aopen+label%3Ateam-Android" class="external">known issues</a>.</p> <devsite-hats-survey class="nocontent" hats-id="VxqvKSur40kxBYCLVTd0SSGykbno" listnr-id="5207477"></devsite-hats-survey> </div> <devsite-recommendations display="in-page" hidden yield> </devsite-recommendations> <devsite-thumb-rating position="footer"> </devsite-thumb-rating> <devsite-recommendations id="recommendations-link" yield></devsite-recommendations> <div class="devsite-floating-action-buttons"> </div> </article> <devsite-content-footer class="nocontent"> <p>Content and code samples on this page are subject to the licenses described in the <a href="/license">Content License</a>. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.</p> <p>Last updated 2024-11-12 UTC.</p> </devsite-content-footer> <devsite-notification > </devsite-notification> <div class="devsite-content-data"> <template class="devsite-content-data-template"> [[["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 2024-11-12 UTC."],[],[]] </template> </div> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> <nav class="devsite-footer-promos nocontent" aria-label="Promotions"> <ul class="devsite-footer-promos-list"> <li class="devsite-footer-promo"> <a href="//x.com/AndroidDev" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer X Promo" > <picture> <source class="devsite-dark-theme" srcset="https://developer.android.com/_static/android/images/logo-x_dt.svg" media="(prefers-color-scheme: dark)" loading="lazy" alt="X"> <img class="devsite-footer-promo-icon" src="/_static/android/images/logo-x.svg" loading="lazy" alt="X"> </picture> <span class="devsite-footer-promo-label"> X </span> </a> <div class="devsite-footer-promo-description">Follow @AndroidDev on X</div> </li> <li class="devsite-footer-promo"> <a href="//www.youtube.com/user/androiddevelopers" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer YouTube Promo" > <picture> <source class="devsite-dark-theme" srcset="https://developer.android.com/_static/android/images/logo-youtube_dt.svg" media="(prefers-color-scheme: dark)" loading="lazy" alt="YouTube"> <img class="devsite-footer-promo-icon" src="//www.gstatic.com/images/icons/material/product/2x/youtube_48dp.png" loading="lazy" alt="YouTube"> </picture> <span class="devsite-footer-promo-label"> YouTube </span> </a> <div class="devsite-footer-promo-description">Check out Android Developers on YouTube</div> </li> <li class="devsite-footer-promo"> <a href="//www.linkedin.com/showcase/androiddev" class="devsite-footer-promo-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer LinkedIn Promo" > <picture> <source class="devsite-dark-theme" srcset="https://developer.android.com/_static/android/images/logo-linkedin_dt.svg" media="(prefers-color-scheme: dark)" loading="lazy" alt="LinkedIn"> <img class="devsite-footer-promo-icon" src="/_static/android/images/logo-linkedin.svg" loading="lazy" alt="LinkedIn"> </picture> <span class="devsite-footer-promo-label"> LinkedIn </span> </a> <div class="devsite-footer-promo-description">Connect with the Android Developers community on LinkedIn</div> </li> </ul> </nav> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">More Android</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="//www.android.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Android </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.android.com/enterprise/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Android for Enterprise </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.android.com/security-center/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > Security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//source.android.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Source </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/news" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > News </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//android-developers.googleblog.com/" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" > Blog </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/podcasts" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" > Podcasts </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Discover</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/games" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Gaming </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/ml" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Machine Learning </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/health-and-fitness" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > Health & Fitness </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/media" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Camera & Media </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/privacy" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > Privacy </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/training/connectivity/5g" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" > 5G </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Android Devices</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/large-screens" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Large screens </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/wear" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Wear OS </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/chrome-os" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > ChromeOS devices </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/cars" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Android for cars </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/tv" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > Android TV </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Releases</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/15" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Android 15 </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/14" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Android 14 </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/13" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > Android 13 </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/12" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Android 12 </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/11" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > Android 11 </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/10" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 6)" > Android 10 </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/about/versions/pie" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 7)" > Pie </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Documentation and Downloads</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/studio/intro" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Android Studio guide </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/guide" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Developers guides </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/reference" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > API reference </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/studio" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Download Studio </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/ndk" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 5)" > Android NDK </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Support</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="//issuetracker.google.com/issues/new?component=190923&template=841312" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 1)" > Report platform bug </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//issuetracker.google.com/issues/new?component=192697" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 2)" > Report documentation bug </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//support.google.com/googleplay/android-developer" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 3)" > Google Play support </a> </li> <li class="devsite-footer-linkbox-item"> <a href="https://g.co/userresearch/androiddeveloperfooter" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Link (index 4)" > Join research studies </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-sites" aria-label="Other Google Developers websites"> <a href="https://developers.google.com/" class="devsite-footer-sites-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google Developers Link"> <picture> <source srcset="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup-google-for-developers-dark-theme.svg" media="(prefers-color-scheme: none)" class="devsite-dark-theme" loading="lazy" alt="Google Developers"> <img class="devsite-footer-sites-logo" src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup-google-for-developers.svg" loading="lazy" alt="Google Developers"> </picture> </a> <ul class="devsite-footer-sites-list"> <li class="devsite-footer-sites-item"> <a href="//developer.android.com" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Android Link" > Android </a> </li> <li class="devsite-footer-sites-item"> <a href="//developer.chrome.com/home" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Chrome Link" > Chrome </a> </li> <li class="devsite-footer-sites-item"> <a href="//firebase.google.com" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Firebase Link" > Firebase </a> </li> <li class="devsite-footer-sites-item"> <a href="//cloud.google.com" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer Google Cloud Platform Link" > Google Cloud Platform </a> </li> <li class="devsite-footer-sites-item"> <a href="//developers.google.com/products/" class="devsite-footer-sites-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Footer All products Link" > All products </a> </li> </ul> </nav> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link" > Privacy </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/license" data-category="Site-Wide Custom Events" data-label="Footer License link" > License </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="/distribute/marketing-tools/brand-guidelines" data-category="Site-Wide Custom Events" data-label="Footer Brand guidelines link" > Brand guidelines </a> </li> <li class="devsite-footer-utility-item glue-cookie-notification-bar-control"> <a class="devsite-footer-utility-link gc-analytics-event" href="#" data-category="Site-Wide Custom Events" data-label="Footer Manage cookies link" aria-hidden="true" > Manage cookies </a> </li> <li class="devsite-footer-utility-item devsite-footer-utility-button"> <span class="devsite-footer-utility-description">Get news and tips by email</span> <a class="devsite-footer-utility-link gc-analytics-event" href="/updates" data-category="Site-Wide Custom Events" data-label="Footer Subscribe link" > Subscribe </a> </li> </ul> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es_419" >Español – América Latina</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pl" >Polski</a> </li> <li role="presentation"> <a role="menuitem" lang="pt_br" >Português – Brasil</a> </li> <li role="presentation"> <a role="menuitem" lang="vi" >Tiếng Việt</a> </li> <li role="presentation"> <a role="menuitem" lang="tr" >Türkçe</a> </li> <li role="presentation"> <a role="menuitem" lang="ru" >Русский</a> </li> <li role="presentation"> <a role="menuitem" lang="he" >עברית</a> </li> <li role="presentation"> <a role="menuitem" lang="ar" >العربيّة</a> </li> <li role="presentation"> <a role="menuitem" lang="fa" >فارسی</a> </li> <li role="presentation"> <a role="menuitem" lang="hi" >हिंदी</a> </li> <li role="presentation"> <a role="menuitem" lang="bn" >বাংলা</a> </li> <li role="presentation"> <a role="menuitem" lang="th" >ภาษาไทย</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_tw" >中文 – 繁體</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> </nav> </div> </devsite-footer-utility> <devsite-panel></devsite-panel> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip ></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics> <script type="application/json" analytics>[]</script> <script type="application/json" tag-management>{"at": "True", "ga4": [{"id": "G-QFRN08RN6E", "purpose": 0}], "ga4p": [{"id": "G-QFRN08RN6E", "purpose": 0}], "gtm": [{"id": "GTM-KMSWPCJ", "purpose": 0}], "parameters": {"internalUser": "False", "language": {"machineTranslated": "False", "requested": "en", "served": "en"}, "pageType": "article", "projectName": "Android Studio", "signedIn": "False", "tenant": "android", "recommendations": {"sourcePage": "", "sourceType": 0, "sourceRank": 0, "sourceIdenticalDescriptions": 0, "sourceTitleWords": 0, "sourceDescriptionWords": 0, "experiment": ""}, "experiment": {"ids": ""}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <android-fully-clickable target=" .android-case-study .devsite-landing-row-item, .android-grouped-resources .devsite-landing-row-item, .android-grouped-resources-primary .devsite-landing-row-item, .android-grouped-resources-secondary .devsite-landing-row-item, .android-guide-cards .devsite-landing-row-item, .android-illustrated-resources-index .devsite-landing-row-item, .android-illustrated-resources-primary .devsite-landing-row-item, .android-illustrated-resources-secondary .devsite-landing-row-item, .android-illustrated-resources-secondary-small .devsite-landing-row-item, .android-illustrated-resources-tertiary .devsite-landing-row-item, .android-illustrated-resources-tertiary-small .devsite-landing-row-item, .android-promo .devsite-landing-row-item, .android-quick-link, .android-samples .devsite-card-wrapper, .fully-clickable" watch=".android-samples, devsite-content"></android-fully-clickable> <script nonce="o1esEf+XPQb+g82NoWqiE94BJ9Q1oL"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/js/app_loader.js', '[3,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android","https://android-dot-devsite-v2-prod.appspot.com",1,null,["/_pwa/android/manifest.json","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/images/video-placeholder.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/favicon.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/android/images/lockup.svg","https://fonts.googleapis.com/css?family=Google+Sans:400,500,600,700|Google+Sans+Text:400,400italic,500,500italic,600,600italic,700,700italic|Roboto+Mono:400,500,700&display=swap"],1,null,[1,6,8,12,14,17,21,25,50,52,63,70,75,76,80,87,91,92,93,97,98,100,101,102,103,104,105,107,108,109,110,112,113,117,118,120,122,124,125,126,127,129,130,131,132,133,134,135,136,138,140,141,147,148,149,151,152,156,157,158,159,161,163,164,168,169,170,179,180,182,183,186,191,193,196],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg","developer.android.com","AIzaSyAQk0fBONSGUqCNznf6Krs82Ap1-NV6J4o","AIzaSyCCxcqdrZ_7QMeLCRY20bh_SXdAYqy70KY",null,null,null,["Search__enable_ai_eligibility_checks","DevPro__enable_cloud_innovators_plus","Cloud__enable_cloud_dlp_service","MiscFeatureFlags__developers_footer_image","MiscFeatureFlags__enable_variable_operator","MiscFeatureFlags__enable_explain_this_code","Profiles__enable_recognition_badges","Significatio__enable_by_tenant","Search__enable_ai_search_summaries","Cloud__enable_cloud_shell_fte_user_flow","Profiles__enable_release_notes_notifications","Profiles__require_profile_eligibility_for_signin","BookNav__enable_tenant_cache_key","Profiles__enable_profile_collections","Cloud__enable_cloudx_ping","Analytics__enable_clearcut_logging","Experiments__reqs_query_experiments","MiscFeatureFlags__enable_firebase_utm","Profiles__enable_public_developer_profiles","TpcFeatures__enable_mirror_tenant_redirects","MiscFeatureFlags__developers_footer_dark_image","Cloud__enable_cloudx_experiment_ids","Cloud__enable_llm_concierge_chat","Search__enable_dynamic_content_confidential_banner","Profiles__enable_dashboard_curated_recommendations","Profiles__enable_completecodelab_endpoint","CloudShell__cloud_shell_button","EngEduTelemetry__enable_engedu_telemetry","Cloud__enable_cloud_shell","MiscFeatureFlags__enable_dark_theme","CloudShell__cloud_code_overflow_menu","Search__enable_suggestions_from_borg","TpcFeatures__enable_required_headers","Profiles__enable_awarding_url","Cloud__enable_cloud_facet_chat","MiscFeatureFlags__enable_view_transitions","Profiles__enable_complete_playlist_endpoint","Cloud__enable_free_trial_server_call","Cloud__enable_legacy_calculator_redirect","Concierge__enable_pushui","MiscFeatureFlags__enable_project_variables","MiscFeatureFlags__emergency_css","Search__enable_page_map","Profiles__enable_developer_profiles_callout","Profiles__enable_page_saving","DevPro__enable_developer_subscriptions"],null,null,"AIzaSyBLEMok-5suZ67qRPzx0qUtbnLmyT_kCVE","https://developerscontentserving-pa.googleapis.com","AIzaSyCM4QpTRSqP5qI4Dvjt4OAScIN8sOUlO-k","https://developerscontentsearch-pa.googleapis.com",2,4,null,"https://developerprofiles-pa.googleapis.com",[3,"android","Android Developers","developer.android.com",null,"android-dot-devsite-v2-prod.appspot.com",null,null,[null,1,null,null,null,null,null,null,null,null,null,[1],null,null,null,null,null,null,[1],[1,null,null,[1,20],"/recommendations"],null,null,null,[1,null,1],[1,1,null,1,1]],null,[18,null,null,null,null,null,"/images/lockup.svg","/images/touchicon-180.png",null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,null,null,"/images/lockup-dark-theme.svg",[]],[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[6,1,14,15,20,22,23,28,29,37,43],null,[[null,null,1],[1,1]],[[null,null,null,null,null,null,null,[["G-QFRN08RN6E"],null,null,[["G-QFRN08RN6E",1]]],null,null,null,null,1],null,[[2,2],[1,1]]],null,4,null,null,null,null,null,null,null,null,null,null,null,null,null,"android.devsite.google"],null,"pk_live_5170syrHvgGVmSx9sBrnWtA5luvk9BwnVcvIi7HizpwauFG96WedXsuXh790rtij9AmGllqPtMLfhe2RSwD6Pn38V00uBCydV4m"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html>