В Android Studio установите Android SDK следующим образом:
На вкладке «Платформы SDK» выберите Android 14.0 с последним уровнем расширения .
На вкладке Инструменты SDK выберите Android SDK Build-Tools 34 или новее.
Объявите уровень API компиляции вашего приложения и уровень расширения SDK следующим образом:
android{compileSdk=34compileSdkExtension=12// The rest of your configuration...}
Настройка образа устройства или эмулятора
Следуйте инструкциям в образце репозитория , чтобы настроить Privacy Sandbox на устройстве Android 14+ или в образе эмулятора, чтобы обеспечить сквозное тестирование.
Примеры кода
В качестве справочного материала при следовании этому руководству мы создали образец проекта на языке программирования Kotlin.
[null,null,["Последнее обновление: 2025-01-24 UTC."],[[["Use the latest Canary build of Android Studio (Ladybug Canary 1 or later) with Android Gradle Plugin (AGP) 8.7.0-alpha01 or later for building apps that consume runtime-enabled SDKs."],["Install Android SDK Platform 14.0, Android SDK Build-Tools 34 or later, and set the compileSdk to 34 and compileSdkExtension to 12 in your app's build configuration."],["Set up the Privacy Sandbox on an Android 14+ device or emulator image following the instructions on the sample repository for end-to-end testing."],["Refer to the provided sample project in Kotlin for guidance on building runtime-enabled SDKs."]]],["Use the latest Android Studio Canary build, including Android Gradle Plugin (AGP) 8.7.0-alpha01 or later. Install Android 14.0 with the latest extension level and Android SDK Build-Tools 34 or later. Configure the app's `compileSdk` to 34 and `compileSdkExtension` to 12. Set up the Privacy Sandbox on an Android 14+ device or emulator image by following the linked sample repository instructions. Completion of these device instructions is mandatory to build the ASB bundle.\n"]]