Set up your development environment for Privacy Sandbox on Android
Stay organized with collections
Save and categorize content based on your preferences.
Follow the instructions on this page to set up the Privacy Sandbox on Android
SDK in Android Studio. First, it is recommended to Install and use the latest
Canary build of Android Studio. Then, within Android Studio, install the SDK
and relevant build tools as follows:
In Android Studio, go to Tools > SDK Manager.
In the SDK Platforms tab, select the latest non-preview SDK version and the
newest SDK Extension Release.
In this example, the latest SDK version is Android 15 (API Level 35) with the latest extension being extension 14.
Click Apply to install the SDK and extension.
In the SDK Tools tab, select the latest Android SDK Build-Tools.
In this example, the latest build tools, platform tools, and emulator are API Level 35.
Additionally, check that you have selected the latest Android SDK Platform-Tools
and Android Emulator.
Click Apply to install the tools selected.
Ensure that you have the latest version of the Android Gradle Plugin by
navigating to Tools -> AGP Upgrade Assistant and following the on-screen
instructions to update your project to take advantage of the latest features,
improvements, and fixes.
Declare the correct API levels
To use the Privacy Sandbox APIs in the latest Android AdServices SDK extension,
declare your app's compile API level and SDK extension level inside of your
app's build.gradle file:
android{// this will correspond to the API level shown in the SDK installation stepscompileSdk=35// this will correspond to the extenson version number in the API level// column of the extension installationcompileSdkExtension=14}
Get the Privacy Sandbox on Android on a supported device
After you complete the preceding setup steps, you can then test Privacy Sandbox
on Android. See Configure a device or emulator image for more information.
[[["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 2025-03-11 UTC."],[[["Follow the instructions to install the Privacy Sandbox on Android SDK within Android Studio, utilizing the latest Canary or Stable build for testing."],["Install necessary components including Android 13.0 with Extension Level 5, Android UpsideDownCakePrivacySandbox Preview (Developer Preview only), and Android SDK Build-Tools 33 or later."],["Declare the correct API levels based on whether targeting Beta or Developer Preview, with specific instructions for each."],["Ensure you have a supported device configured for testing the Privacy Sandbox on Android after completing setup."]]],["Install the latest non-preview Android SDK version and newest SDK Extension Release via Android Studio's SDK Manager. Also install the latest Android SDK Build-Tools, Platform-Tools, and Emulator. Update the Android Gradle Plugin to its latest version. In the app's `build.gradle` file, declare the `compileSdk` to the latest SDK version and `compileSdkExtension` to the latest extension number. Afterward, testing can be done on a supported device by following device or emulator configuration instructions.\n"]]