Konfigurowanie pakietu Android SDK 16
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Aby tworzyć aplikacje przy użyciu interfejsów API Androida 16 i testować je pod kątem zmian w działaniu Androida 16, musisz skonfigurować pakiet SDK Androida 16. Aby skonfigurować pakiet Android 16 SDK w Android Studio oraz skompilować i uruchomić aplikację na Androidzie 16, postępuj zgodnie z instrukcjami na tej stronie.
Pobieranie Android Studio
Pakiet SDK Androida 16 zawiera zmiany, które są niezgodne z niektórymi starszymi wersjami Androida Studio. Aby zapewnić sobie jak najlepsze środowisko programistyczne w przypadku pakietu Android 16 SDK, używaj Androida Studio Meerkat | 2024.3.1 lub nowszego.
Pobierz Android Studio
Aktualizowanie konfiguracji kompilacji aplikacji
Aby uzyskać dostęp do interfejsów API Androida 16, otwórz plik build.gradle
lub build.gradle.kts
aplikacji i zaktualizuj compileSdk
dla Androida 16 w ten sposób:
Groovy
android {
compileSdk = 36
}
Kotlin
android {
compileSdk = 36
}
Android Studio może dostarczać kontekstowe informacje o zmianach w działaniu za pomocą Asystenta uaktualniania pakietu Android SDK.
Gdy wszystko będzie gotowe do włączenia nowych zachowań środowiska wykonawczego w Androidzie 16, zaktualizuj plik targetSdk
aplikacji w ten sposób:
Groovy
android {
defaultConfig {
targetSdk = 36
}
}
Kotlin
android {
defaultConfig {
targetSdk = 36
}
}
Ręczne instalowanie pakietu SDK
W Android Studio możesz zainstalować pakiet Android 16 SDK w ten sposób:
- Kliknij Narzędzia > Menedżer SDK.
- Na karcie Platformy pakietu SDK rozwiń sekcję Android Baklava Preview i wybierz pakiet Android SDK Platform Baklava.
- Na karcie SDK Tools rozwiń sekcję Android SDK Build-Tools 36 i wybierz najnowszą wersję
36.x.x
.
- Aby zainstalować pakiet SDK, kliknij OK.
Dalsze kroki
Aby dowiedzieć się więcej o zmianach, które mogą mieć wpływ na Twoją aplikację, i o tym, jak je w niej przetestować, przeczytaj te artykuły:
Więcej informacji o nowych interfejsach API i funkcjach dostępnych w Androidzie 16 znajdziesz w artykule Funkcje Androida 16.
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-08-27 UTC."],[],[],null,["To develop with Android 16 APIs and test your app with the Android 16 behavior\nchanges, you need to set up the Android 16 SDK. Follow the instructions on this\npage to set up the Android 16 SDK in Android Studio and build and run your app\non Android 16.\n\nGet Android Studio\n\nThe Android 16 SDK includes changes that are not compatible with some lower\nversions of Android Studio. For the best development experience with the Android\n16 SDK, use Android Studio Meerkat \\| 2024.3.1 or higher.\n\n\u003cbr /\u003e\n\n[Get Android Studio](/studio)\n\nUpdate your app's build configuration **Warning:** If your project does not use Android Gradle plugin 8.9.0-rc01 or higher, first run the [Android Gradle plugin Upgrade Assistant](/r/tools/upgrade-assistant/agp-upgrade-assistant) to upgrade to at least AGP 8.9.0-rc01.\n\nTo access Android 16 APIs, open your app's `build.gradle` or `build.gradle.kts`\nfile and update the `compileSdk` for Android 16 as follows: \n\nGroovy \n\n```groovy\nandroid {\n compileSdk = 36\n}\n```\n\nKotlin \n\n```kotlin\nandroid {\n compileSdk = 36\n}\n```\n\nAndroid Studio can provide contextual information about the\nbehavior changes through the\n[Android SDK Upgrade Assistant](/r/studio-ui/ide/android-sdk-upgrade-assistant).\nOnce you're ready to opt in to the new runtime behaviours for Android 16,\nupdate your app's `targetSdk` as follows: \n\nGroovy \n\n```groovy\nandroid {\n defaultConfig {\n targetSdk = 36\n }\n}\n```\n\nKotlin \n\n```kotlin\nandroid {\n defaultConfig {\n targetSdk = 36\n }\n}\n```\n\nManually install the SDK\n\nWithin Android Studio, you can install the Android 16 SDK as follows:\n\n1. Click **Tools \\\u003e SDK Manager**.\n2. In the **SDK Platforms tab** , expand the **Android Baklava Preview** section and select the **Android SDK Platform Baklava** package.\n3. In the **SDK Tools** tab, expand the **Android SDK Build-Tools 36** section and select the latest `36.x.x` version.\n4. Click **OK** to install the SDK.\n\nNext steps\n\nTo learn about the changes that might affect your app, and to learn how to test\nthese changes in your app, read the following topics:\n\n- [Behavior changes that affect all apps](/about/versions/16/behavior-changes-all)\n- [Behavior changes that affect only apps that target Android 16](/about/versions/16/behavior-changes-16)\n\nTo learn more about new APIs and features available in Android 16, read [Android\n16 features](/about/versions/16/features)."]]