CINXE.COM

Kotlin for Android | Kotlin Documentation

<!DOCTYPE html SYSTEM "about:legacy-compat"> <html lang="en-US" data-preset="contrast" data-primary-color="#307FFF"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="built-on" content="2024-11-18T21:26:09.780111691"><meta name="build-number" content="3272"><script> (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'}); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&amp;l=' + l : ''; j.async = true; j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-5P98'); </script> <script src="static/v3/analytics.js"></script> <title>Kotlin for Android | Kotlin Documentation</title><script type="application/json" id="virtual-toc-data">[]</script><script type="application/json" id="topic-shortcuts"></script><link href="static/v3/app.css?v=6.11.0-footer" rel="stylesheet"><link rel="icon" type="image/svg" sizes="16x16" href="https://kotlinlang.org/assets/images/favicon.svg?v2"><link rel="icon" type="image/x-icon" sizes="32x32" href="https://kotlinlang.org/assets/images/favicon.ico?v2"><link rel="icon" type="image/png" sizes="96x96" href="https://kotlinlang.org/assets/images/apple-touch-icon.png?v2"><link rel="icon" type="image/png" sizes="300x300" href="https://kotlinlang.org/assets/images/apple-touch-icon-72x72.png?v2"><link rel="icon" type="image/png" sizes="500x500" href="https://kotlinlang.org/assets/images/apple-touch-icon-114x114.png?v2"><meta name="image" content="https://kotlinlang.org/assets/images/open-graph/docs.png"><!-- Open Graph --><meta property="og:title" content="Kotlin for Android | Kotlin"><meta property="og:description" content=""><meta property="og:image" content="https://kotlinlang.org/assets/images/open-graph/docs.png"><meta property="og:site_name" content="Kotlin Help"><meta property="og:type" content="website"><meta property="og:locale" content="en_US"><meta property="og:url" content="https://kotlinlang.org/docs/android-overview.html"><!-- End Open Graph --><!-- Twitter Card --><meta name="twitter:card" content="summary_large_image"><meta name="twitter:site" content="@kotlin"><meta name="twitter:title" content="Kotlin for Android | Kotlin"><meta name="twitter:description" content=""><meta name="twitter:creator" content="@kotlin"><meta name="twitter:image:src" content="https://kotlinlang.org/assets/images/open-graph/docs.png"><!-- End Twitter Card --><!-- Schema.org WebPage --><script type="application/ld+json">{ "@context": "http://schema.org", "@type": "WebPage", "@id": "https://kotlinlang.org/docs/android-overview.html#webpage", "url": "https://kotlinlang.org/docs/android-overview.html", "name": "Kotlin for Android | Kotlin", "description": "", "image": "https://kotlinlang.org/assets/images/open-graph/docs.png", "inLanguage":"en-US" }</script><!-- End Schema.org --><!-- Schema.org WebSite --><script type="application/ld+json">{ "@type": "WebSite", "@id": "https://kotlinlang.org/docs/#website", "url": "https://kotlinlang.org/docs/", "name": "Kotlin Help" }</script><!-- End Schema.org --><style>a[href="test-page.html"] { visibility: hidden; }</style></head><body data-id="android-overview" data-main-title="Kotlin for Android" data-article-props="{&quot;seeAlsoStyle&quot;:&quot;links&quot;}" data-template="article" data-breadcrumbs="Kotlin overview" data-edit-url="https://github.com/JetBrains/kotlin-web-site/edit/master/docs/topics/android-overview.md"><div class="wrapper"><main class="panel _main"><header class="panel__header"><div class="container"><h3>Kotlin Help</h3><div class="panel-trigger"></div></div></header><section class="panel__content"><div class="container"><article class="article" data-shortcut-switcher="inactive"><h1 data-toc="android-overview" id="android-overview.md">Kotlin for Android</h1><p id="-f0kgt1_2">Android mobile development has been <a href="https://developer.android.com/kotlin/first" id="-f0kgt1_9" data-external="true" rel="noopener noreferrer">Kotlin-first</a> since Google I/O in 2019.</p><p id="-f0kgt1_3">Over 50% of professional Android developers use Kotlin as their primary language, while only 30% use Java as their main language. 70% of developers whose primary language is Kotlin say that Kotlin makes them more productive.</p><p id="-f0kgt1_4">Using Kotlin for Android development, you can benefit from:</p><ul class="list _bullet" id="-f0kgt1_5"><li class="list__item" id="-f0kgt1_10"><p><span class="control" id="-f0kgt1_18">Less code combined with greater readability</span>. Spend less time writing your code and working to understand the code of others.</p></li><li class="list__item" id="-f0kgt1_11"><p><span class="control" id="-f0kgt1_19">Fewer common errors</span>. Apps built with Kotlin are 20% less likely to crash based on <a href="https://medium.com/androiddevelopers/fewer-crashes-and-more-stability-with-kotlin-b606c6a6ac04" id="-f0kgt1_20" data-external="true" rel="noopener noreferrer">Google's internal data</a>.</p></li><li class="list__item" id="-f0kgt1_12"><p><span class="control" id="-f0kgt1_21">Kotlin support in Jetpack libraries</span>. <a href="https://developer.android.com/jetpack/compose" id="-f0kgt1_22" data-external="true" rel="noopener noreferrer">Jetpack Compose</a> is Android's recommended modern toolkit for building native UI in Kotlin. <a href="https://developer.android.com/kotlin/ktx" id="-f0kgt1_23" data-external="true" rel="noopener noreferrer">KTX extensions</a> add Kotlin language features, like coroutines, extension functions, lambdas, and named parameters to existing Android libraries.</p></li><li class="list__item" id="-f0kgt1_13"><p><span class="control" id="-f0kgt1_24">Support for multiplatform development</span>. Kotlin Multiplatform allows development for not only Android but also <a href="https://kotlinlang.org/lp/multiplatform/" id="-f0kgt1_25" data-external="true" rel="noopener noreferrer">iOS</a>, backend, and web applications. <a href="https://developer.android.com/kotlin/multiplatform" id="-f0kgt1_26" data-external="true" rel="noopener noreferrer">Some Jetpack libraries</a> are already multiplatform. <a href="https://www.jetbrains.com/lp/compose-multiplatform/" id="-f0kgt1_27" data-external="true" rel="noopener noreferrer">Compose Multiplatform</a>, JetBrains' declarative UI framework based on Kotlin and Jetpack Compose, makes it possible to share UIs across platforms &ndash; iOS, Android, desktop, and web.</p></li><li class="list__item" id="-f0kgt1_14"><p><span class="control" id="-f0kgt1_28">Mature language and environment</span>. Since its creation in 2011, Kotlin has developed continuously, not only as a language but as a whole ecosystem with robust tooling. Now it's seamlessly integrated into <a href="https://developer.android.com/studio" id="-f0kgt1_29" data-external="true" rel="noopener noreferrer">Android Studio</a> and is actively used by many companies for developing Android applications.</p></li><li class="list__item" id="-f0kgt1_15"><p><span class="control" id="-f0kgt1_30">Interoperability with Java</span>. You can use Kotlin along with the Java programming language in your applications without needing to migrate all your code to Kotlin.</p></li><li class="list__item" id="-f0kgt1_16"><p><span class="control" id="-f0kgt1_31">Easy learning</span>. Kotlin is very easy to learn, especially for Java developers.</p></li><li class="list__item" id="-f0kgt1_17"><p><span class="control" id="-f0kgt1_32">Big community</span>. Kotlin has great support and many contributions from the community, which is growing all over the world. Over 95% of the top thousand Android apps use Kotlin.</p></li></ul><p id="-f0kgt1_6">Many startups and Fortune 500 companies have already developed Android applications using Kotlin, see the list on <a href="https://developer.android.com/kotlin/stories" id="-f0kgt1_33" data-external="true" rel="noopener noreferrer">the Google website for Android developers</a>.</p><p id="-f0kgt1_7">To start using Kotlin for:</p><ul class="list _bullet" id="-f0kgt1_8"><li class="list__item" id="-f0kgt1_34"><p>Android development, read <a href="https://developer.android.com/kotlin/get-started" id="-f0kgt1_36" data-external="true" rel="noopener noreferrer">Google's documentation for developing Android apps with Kotlin</a>.</p></li><li class="list__item" id="-f0kgt1_35"><p>Developing cross-platform mobile applications, see <a href="https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-create-first-app.html" id="-f0kgt1_37" data-external="true" rel="noopener noreferrer">Get started with Kotlin Multiplatform for Android and iOS</a>.</p></li></ul><div class="last-modified">Last modified: 20 August 2024</div><div data-feedback-placeholder="true"></div><div class="navigation-links _bottom"><a href="server-overview.html" class="navigation-links__prev">Kotlin for server side</a><a href="wasm-overview.html" class="navigation-links__next">Kotlin/Wasm</a></div></article><div id="disqus_thread"></div></div></section></main></div><script src="static/v3/app.js"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10