כדי לפתח באמצעות ממשקי API של Android 11 ולבדוק את האפליקציה עם שינויי ההתנהגות של Android 11, צריך לפעול לפי ההוראות שבדף הזה כדי להגדיר את Android 11 SDK ב-Android Studio, וליצור ולהפעיל את האפליקציה ב-Android 11.
הורדת Android Studio
Android 11 SDK כולל שינויים שלא תואמים לחלק מהגרסאות הנמוכות יותר של Android Studio. כדי ליהנות מחוויית הפיתוח הטובה ביותר עם Android 11 SDK, מומלץ להשתמש ב-Android Studio 4.2 ואילך.
אפשר לקמפל ולבדוק אפליקציות ל-Android 11 באמצעות Android Studio 3.3 ואילך, אבל חלק מהמשתמשים ב-Android 11 SDK עלולים להיתקל בכשלים בסנכרון Gradle ובאזהרות לגבי תלות לא עדכנית.
חשוב לזכור שאפשר להשאיר את הגרסה הקיימת של Android Studio מותקנת, כי אפשר להתקין כמה גרסאות זו לצד זו.
הורדת Android 11 SDK
אחרי שמתקינים את Android Studio ופותחים אותו, מתקינים את Android 11
SDK באופן הבא:
לוחצים על Tools > SDK Manager (כלים > מנהל ה-SDK), ואז לוחצים על Show Package Details (הצגת פרטי החבילה).
בכרטיסייה SDK Tools, מרחיבים את הקטע Android SDK Build-Tools 34 ובוחרים את הגרסה העדכנית ביותר 30.x.x.
לוחצים על החלה > אישור כדי להוריד ולהתקין את החבילות שנבחרו.
עדכון הגדרת ה-build
שינוי הגדרות הבנייה של האפליקציה לטירגוט Android 11 מאפשר לאפליקציה גישה לממשקי ה-API של Android 11, ומאפשר לכם לבדוק באופן מלא את התאימות של האפליקציה בזמן שאתם מתכוננים להוסיף תמיכה מלאה ב-Android 11. כדי לעשות את זה, פותחים את הקובץ build.gradle ברמת המודול ומעדכנים את compileSdkVersion ואת targetSdkVersion:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-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-08-27 (שעון UTC)."],[],[],null,["Android 11 contains a variety of great ways you can extend your\napp. Android 11\nalso includes behavior changes to improve battery life and security, and to\n[enhance user privacy](/about/versions/11/privacy). Some of these behavior changes [only affect apps that\ntarget Android 11](/about/versions/11/behavior-changes-11), while others [affect all apps when they are running on an\nAndroid 11 device](/about/versions/11/behavior-changes-all), regardless of an app's `targetSDKVersion`.\n\nTo develop with Android 11 APIs and test your app with the\nAndroid 11 behavior changes, follow the instructions on this page\nto set up the Android 11 SDK in Android Studio and build and run\nyour app on Android 11.\n\nGet Android Studio\n\nThe Android 11 SDK includes changes that are not compatible with\nsome lower versions of Android Studio. For the best development experience with\nthe Android 11 SDK, use Android Studio 4.2 or higher.\n\n[Get Android Studio](/studio)\n\nYou can compile and test Android 11 apps using Android Studio\n3.3 and higher, but some users of the Android 11 SDK may\nencounter Gradle sync failures and warnings about outdated dependencies.\nRemember, you can keep your existing version of Android Studio installed,\nbecause you can [install multiple versions side by side](/studio/preview/install-preview).\n\nGet the Android 11 SDK\n\nAfter you install and open Android Studio, install the Android 11\nSDK as follows:\n\n1. Click **Tools \\\u003e SDK Manager** , then click **Show Package Details**.\n2. In the **SDK Platforms** tab, expand the **Android 11.0 (\"R\")** section and select the **Android SDK Platform 30** package.\n3. In the **SDK Tools** tab, expand the **Android SDK Build-Tools 34** section and select the latest `30.x.x` version.\n4. Click **Apply \\\u003e OK** to download and install the selected packages.\n\nUpdate your build configuration\n\nChanging your app's build configuration to target Android 11 gives your app\naccess to the Android 11 APIs and lets you fully test your app's compatibility\nas you [prepare to add full support for Android 11](/about/versions/11/migration#setup_sdk). To do this, open your\nmodule-level `build.gradle` file and update the `compileSdkVersion` and\n`targetSdkVersion`: \n\nGroovy \n\n```groovy\nandroid {\n compileSdkVersion 30\n\n defaultConfig {\n targetSdkVersion 30\n }\n ...\n}\n```\n\nKotlin \n\n```kotlin\nandroid {\n compileSdkVersion(30)\n\n defaultConfig {\n targetSdkVersion(30)\n }\n ...\n}\n```\n| **Note:** If you're not ready yet to fully support Android 11, you can still perform app compatibility testing using a debuggable app, an Android 11 device, and the [compatibility framework](/guide/app-compatibility/test-debug), without changing either your app's `compileSdkVersion` or `targetSdkVersion`.\n\nTo learn about the changes in Android 11 that might affect your\napp so you can begin testing for them, read the following pages:\n\n- [Android 11 behavior changes affecting all apps](/about/versions/11/behavior-changes-all)\n- [Android 11 behavior changes affecting apps that target Android 11](/about/versions/11/behavior-changes-11)\n- [Android 11 privacy changes](/about/versions/11/privacy)\n\nTo learn more about new APIs available in Android 11, read\n[Android 11 features and APIs](/about/versions/11/features)."]]