קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ב-Google I/O בשנת 2019, הודענו שהפיתוח ל-Android יהיה יותר ויותר מבוסס על Kotlin, ואנחנו עומדים בהתחייבות הזו. Kotlin היא שפת תכנות תמציתית וברורה שמפחיתה שגיאות נפוצות בקוד ומשתלבת בקלות באפליקציות קיימות. אם אתם רוצים ליצור אפליקציית Android, מומלץ להתחיל עם Kotlin כדי ליהנות מהתכונות הטובות ביותר שלה.
כדי לתמוך בפיתוח ל-Android באמצעות Kotlin, הקמנו יחד עם אחרים את Kotlin Foundation ואנחנו ממשיכים להשקיע בשיפור הביצועים של הקומפיילר ובמהירות הבנייה. מידע נוסף על המחויבות של Android ל-Kotlin זמין במאמר המחויבות של Android ל-Kotlin.
למה פיתוח ל-Android מתבצע קודם ב-Kotlin?
בדקנו משוב שהגיע ישירות ממפתחים בכנסים, ממועצת הלקוחות המייעצת (CAB), ממומחי Google למפתחים (GDE) וממחקר המפתחים שלנו. מפתחים רבים כבר נהנים להשתמש ב-Kotlin, והבקשה לתמיכה נוספת ב-Kotlin הייתה ברורה. אלה היתרונות של כתיבה ב-Kotlin לפי מפתחים:
מובן ותמציתי: אפשר לעשות יותר בפחות מאמץ. להביע את הרעיונות שלכם ולצמצם את כמות הקוד הסטנדרטי. 67% מהמפתחים המקצועיים שמשתמשים ב-Kotlin אומרים שהשימוש ב-Kotlin הגדיל את הפרודוקטיביות שלהם.
קוד בטוח יותר: ל-Kotlin יש הרבה תכונות שפה שעוזרות לכם להימנע מטעויות תכנות נפוצות, כמו חריגות של מצביע null.
הסיכוי שאפליקציות ל-Android שמכילות קוד Kotlin יקרסו נמוך ב-20%.
יכולת פעולה הדדית: אפשר להפעיל קוד מבוסס-Java מ-Kotlin, או להפעיל קוד Kotlin מקוד מבוסס-Java. Kotlin תואמת באופן מלא לשפת התכנות Java, כך שאתם יכולים להשתמש ב-Kotlin בפרויקט שלכם במידה שתרצו.
מקביליות מובנית: קורוטינות של Kotlin מאפשרות לעבוד עם קוד אסינכרוני בקלות כמו עם קוד חוסם. קורוטינות מפשטות באופן משמעותי את ניהול המשימות ברקע, החל משיחות ברשת ועד לגישה לנתונים מקומיים.
מה המשמעות של Kotlin-first?
כשנפתח כלים ותוכן חדשים לפיתוח ל-Android, כמו ספריות Jetpack, דוגמאות, מסמכים ותוכן הדרכה, נתכנן אותם תוך התחשבות במשתמשי Kotlin, ונמשיך לספק תמיכה בשימוש בממשקי ה-API שלנו משפת התכנות Java.
שפת Java
Kotlin
תמיכה ב-SDK של הפלטפורמה
כן
כן
תמיכה ב-Android Studio
כן
כן
מוך
כן
כן
תמיכה מודרכת ב-Docs
כן
כן
תמיכה במאמרי העזרה של ה-API
כן
כן
תמיכה ב-AndroidX
כן
כן
ממשקי API ספציפיים ל-Kotlin ב-AndroidX (KTX, coroutines וכו')
המהנדסים שלנו נהנים מהתכונות של שפת Kotlin, וכיום יותר מ-70 אפליקציות של Google מבוססות על Kotlin. זה כולל אפליקציות כמו מפות, Home, Play, Drive והודעות. דוגמה אחת להצלחה מגיעה מצוות Google Home, שבו העברת פיתוח של תכונות חדשות ל-Kotlin הובילה לצמצום של 33% בגודל בסיס הקוד ולצמצום של 30% במספר הקריסות של NPE.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Android’s Kotlin-first approach\n\nAt Google I/O 2019, we announced that Android development will be\nincreasingly Kotlin-first, and we've stood by that commitment. Kotlin is an\nexpressive and concise programming language that reduces common code errors\nand easily integrates into existing apps. If you're looking to build an\nAndroid app, we recommend starting with Kotlin to take advantage of its\nbest-in-class features.\n\nIn an effort to support Android development using Kotlin, we co-founded the\n[Kotlin Foundation](https://kotlinlang.org/foundation/kotlin-foundation.html)\nand have ongoing investments in improving compiler performance and build\nspeed. To learn more about Android's commitment to being Kotlin-first, see\n[Android's commitment to Kotlin](https://android-developers.googleblog.com/2019/12/androids-commitment-to-kotlin.html).\n\nWhy is Android development Kotlin-first?\n----------------------------------------\n\nWe reviewed feedback that came directly from developers at conferences, our\nCustomer Advisory Board (CAB), Google Developer Experts (GDE), and through\nour developer research. Many developers already enjoy using Kotlin, and the\nrequest for more Kotlin support was clear. Here's what developers appreciate\nabout writing in Kotlin:\n\n- **Expressive and concise:** You can do more with less. Express your ideas and reduce the amount of boilerplate code. 67% of professional developers who use Kotlin say Kotlin has increased their productivity.\n- **Safer code:** Kotlin has many language features to help you avoid common programming mistakes such as null pointer exceptions. Android apps that contain Kotlin code are 20% less likely to crash.\n- **Interoperable:** Call Java-based code from Kotlin, or call Kotlin from Java-based code. Kotlin is 100% interoperable with the Java programming language, so you can have as little or as much of Kotlin in your project as you want.\n- **Structured Concurrency:** Kotlin coroutines make asynchronous code as easy to work with as blocking code. Coroutines dramatically simplify background task management for everything from network calls to accessing local data.\n\nWhat does Kotlin-first mean?\n----------------------------\n\nWhen building new Android development tools and content, such as Jetpack\nlibraries, samples, documentation, and training content, we will design\nthem with Kotlin users in mind while continuing to provide support for\nusing our APIs from the Java programming language.\n\n| | Java language | Kotlin |\n|------------------------------------------------------------|---------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| Platform SDK support | Yes | Yes |\n| Android Studio support | Yes | Yes |\n| Lint | Yes | Yes |\n| Guided docs support | Yes | Yes |\n| API docs support | Yes | Yes |\n| AndroidX support | Yes | Yes |\n| AndroidX Kotlin-specific APIs (KTX, coroutines, and so on) | N/A | Yes |\n| Online training | Best effort | Yes |\n| Samples | Best effort | Yes |\n| Multi-platform projects | No | Yes |\n| Jetpack Compose | No | Yes |\n| Compiler plugin support | No | Yes - The [Kotlin Symbol Processing API](https://github.com/google/ksp) was created by Google to develop lightweight compiler plugins. |\n\nWe use Kotlin, too!\n-------------------\n\nOur engineers enjoy the language features Kotlin offers, and today over 70 of\nGoogle's apps are built using Kotlin. This includes apps like Maps, Home, Play,\nDrive, and Messages. One example of success comes from the\n[Google Home team](/stories/apps/google-home), where migrating new feature\ndevelopment to Kotlin resulted in a 33% reduction in codebase size and a 30%\nreduction in the number of NPE crashes.\n\nTo learn more about Kotlin on Android, see the\n[Kotlin on Android FAQ](/kotlin/faq)."]]