ตั้งค่า Android 15 SDK
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการพัฒนาด้วย API ของ Android 15 และทดสอบแอปด้วยการเปลี่ยนแปลงลักษณะการทํางานของ Android 15 คุณต้องตั้งค่า Android 15 SDK ทำตามวิธีการในหน้านี้เพื่อตั้งค่า Android 15 SDK ใน Android Studio รวมถึงสร้างและเรียกใช้แอปใน Android 15
ดาวน์โหลด Android Studio
SDK ของ Android 15 มีการเปลี่ยนแปลงที่ไม่เข้ากันได้กับ Android Studio บางเวอร์ชันที่ต่ำกว่า หากต้องการประสบการณ์การพัฒนาที่ดีที่สุดด้วย Android Dev Platform 15 SDK ให้ใช้ Android Studio Koala Feature Drop | 2024.1.2 ขึ้นไป
ดาวน์โหลด Android Studio
ลองใช้ Android 15
หากยังไม่พร้อมที่จะรองรับ Android 15 อย่างเต็มรูปแบบ คุณยังคงทำการทดสอบความเข้ากันได้ของแอปได้โดยใช้แอปที่แก้ไขข้อบกพร่องได้ อุปกรณ์ Android 15 (รวมถึงอุปกรณ์เสมือนจริง) และเฟรมเวิร์กความเข้ากันได้ โดยไม่ต้องเปลี่ยนแอปให้คอมไพล์หรือกำหนดเป้าหมาย SDK
อัปเดตการกำหนดค่าบิลด์ของแอป
หากต้องการเข้าถึง API ของ Android 15 ให้เปิดไฟล์ build.gradle
หรือ build.gradle.kts
ของแอป แล้วอัปเดต compileSdk
สำหรับ Android 15 ดังนี้
Groovy
android {
compileSdk = 35
}
Kotlin
android {
compileSdk = 35
}
Android Studio สามารถให้ข้อมูลตามบริบทเกี่ยวกับการเปลี่ยนแปลงลักษณะการทำงานผ่าน Android SDK Upgrade Assistant
เมื่อพร้อมเลือกใช้ลักษณะการทํางานรันไทม์แบบใหม่สําหรับ Android 15 แล้ว ให้อัปเดต targetSdk
ของแอปดังนี้
Groovy
android {
defaultConfig {
targetSdk = 35
}
}
Kotlin
android {
defaultConfig {
targetSdk = 35
}
}
ติดตั้ง SDK ด้วยตนเอง
คุณติดตั้ง Android 15 SDK ใน Android Studio ได้โดยทำดังนี้
- คลิกเครื่องมือ > SDK Manager แล้วคลิกแสดงรายละเอียดแพ็กเกจ
- ในแท็บแพลตฟอร์ม SDK ให้ขยายส่วน Android API 35 แล้วเลือกแพ็กเกจ Android SDK Platform 35
- ในแท็บ SDK Tools ให้ขยายส่วน Android SDK Build-Tools 35 แล้วเลือก
35.x.x
เวอร์ชันล่าสุด
- คลิกตกลงเพื่อติดตั้ง SDK
ขั้นตอนถัดไป
หากต้องการดูข้อมูลเกี่ยวกับการเปลี่ยนแปลงที่อาจส่งผลต่อแอปของคุณ และดูวิธีทดสอบการเปลี่ยนแปลงเหล่านี้ในแอป โปรดอ่านหัวข้อต่อไปนี้
ดูข้อมูลเพิ่มเติมเกี่ยวกับ API และฟีเจอร์ใหม่ๆ ที่มีใน Android 15 ได้ที่ฟีเจอร์ของ Android 15
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[null,null,["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# Set up the Android 15 SDK\n\nTo develop with Android 15 APIs and test your app with the Android 15 behavior\nchanges, you need to set up the Android 15 SDK. Follow the instructions on this\npage to set up the Android 15 SDK in Android Studio and build and run your app\non Android 15.\n\nGet Android Studio\n------------------\n\nThe Android 15 SDK includes changes that are not compatible with some lower\nversions of Android Studio. For the best development experience with the Android\n15 SDK, use Android Studio Koala Feature Drop \\| 2024.1.2 or higher.\n\n\u003cbr /\u003e\n\n[Get Android Studio](/studio)\n\nTry out Android 15\n------------------\n\nIf you aren't quite ready to fully support Android 15, you can still\nperform app compatibility testing by using a debuggable app, an Android 15\ndevice (including [virtual devices](/studio/run/managing-avds)), and the [compatibility framework](/about/versions/15/reference/compat-framework-changes),\nwithout changing your app to compile with or target the SDK.\n\nUpdate your app's build configuration\n-------------------------------------\n\n| **Warning:** If your project does not use Android Gradle plugin 8.6.1 or higher, first run the [Android Gradle plugin Upgrade Assistant](/r/tools/upgrade-assistant/agp-upgrade-assistant) to upgrade to at least AGP 8.6.1.\n\nTo access Android 15 APIs, open your app's `build.gradle` or `build.gradle.kts`\nfile and update the `compileSdk` for Android 15 as follows: \n\n### Groovy\n\n```groovy\nandroid {\n compileSdk = 35\n}\n```\n\n### Kotlin\n\n```kotlin\nandroid {\n compileSdk = 35\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 15,\nupdate your app's `targetSdk` as follows: \n\n### Groovy\n\n```groovy\nandroid {\n defaultConfig {\n targetSdk = 35\n }\n}\n```\n\n### Kotlin\n\n```kotlin\nandroid {\n defaultConfig {\n targetSdk = 35\n }\n}\n```\n\nManually install the SDK\n------------------------\n\nWithin Android Studio, you can install the Android 15 SDK as follows:\n\n1. Click **Tools \\\u003e SDK Manager** , then click **Show Package Details**.\n2. In the **SDK Platforms tab** , expand the **Android API 35** section and select the **Android SDK Platform 35** package.\n3. In the **SDK Tools** tab, expand the **Android SDK Build-Tools 35** section and select the latest `35.x.x` version.\n4. Click **OK** to install the SDK.\n\nNext steps\n----------\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/15/behavior-changes-all)\n- [Behavior changes that affect only apps that target Android 15](/about/versions/15/behavior-changes-15)\n\nTo learn more about new APIs and features available in Android 15, read [Android\n15 features](/about/versions/15/features)."]]