Update your app's target SDK version for Wear OS 5
Stay organized with collections
Save and categorize content based on your preferences.
After you update your app to prepare it for Wear OS 5, you can further
improve your app's compatibility with this version of Wear OS by targeting
Android 14 (API level 34).
If you update your target SDK version, handle the system behavior changes
that take effect for apps that target Android 14 or higher.
Update your build file
To update your target SDK version, open your module-level build.gradle
or
build.gradle.kts
file, and update them with values for Android 14.
How you format the values in your build file depends on the version of the
Android Gradle plugin (AGP) that you are using.
AGP 7.0.0 or higher
If you are using AGP 7.0.0 or higher, update your app's build.gradle
or
build.gradle.kts
file with the following values for Android 14:
Groovy
android {
compileSdk 34
...
defaultConfig {
targetSdk 34
}
}
Kotlin
android {
compileSdk = 34
...
defaultConfig {
targetSdk = 34
}
}
AGP 4.2.0 or lower
If you are using AGP 4.2.0 or lower, update your app's build.gradle
or
build.gradle.kts
file with the following values for Android 14:
Groovy
android {
compileSdkVersion "34"
...
defaultConfig {
targetSdkVersion "34"
}
}
Kotlin
android {
compileSdkVersion = "34"
...
defaultConfig {
targetSdkVersion = "34"
}
}
Recommended for you
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-11-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-12 UTC."],[],[],null,["# Update your app's target SDK version for Wear OS 5\n\nAfter you [update your app](/training/wearables/versions/5/changes) to prepare it for Wear OS 5, you can further\nimprove your app's compatibility with this version of Wear OS by targeting\nAndroid 14 (API level 34).\n\nIf you update your target SDK version, handle the system behavior changes\nthat take effect for apps that [target Android 14 or higher](/about/versions/14/behavior-changes-14).\n\nUpdate your build file\n----------------------\n\nTo update your target SDK version, open your module-level `build.gradle` or\n`build.gradle.kts` file, and update them with values for Android 14.\n\nHow you format the values in your build file depends on the version of the\nAndroid Gradle plugin (AGP) that you are using.\n\n### AGP 7.0.0 or higher\n\nIf you are using AGP 7.0.0 or higher, update your app's `build.gradle` or\n`build.gradle.kts` file with the following values for Android 14: \n\n### Groovy\n\n```groovy\nandroid {\n compileSdk 34\n ...\n defaultConfig {\n targetSdk 34\n }\n}\n```\n\n### Kotlin\n\n```kotlin\nandroid {\n compileSdk = 34\n ...\n defaultConfig {\n targetSdk = 34\n }\n}\n```\n\n### AGP 4.2.0 or lower\n\nIf you are using AGP 4.2.0 or lower, update your app's `build.gradle` or\n`build.gradle.kts` file with the following values for Android 14: \n\n### Groovy\n\n```groovy\nandroid {\n compileSdkVersion \"34\"\n ...\n defaultConfig {\n targetSdkVersion \"34\"\n }\n}\n```\n\n### Kotlin\n\n```kotlin\nandroid {\n compileSdkVersion = \"34\"\n ...\n defaultConfig {\n targetSdkVersion = \"34\"\n }\n}\n```\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Update your app's target SDK version for Wear OS 4](/training/wearables/versions/4/update-target-sdk)\n- [Behavior changes: Apps targeting Android 12](/about/versions/12/behavior-changes-12)\n- [Schedule alarms](/develop/background-work/services/alarms/schedule)"]]