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.
- Click Apply to install the SDK and extension.
- In the SDK Tools tab, select the latest Android SDK Build-Tools.
- 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 steps
compileSdk = 35
// this will correspond to the extenson version number in the API level
// column of the extension installation
compileSdkExtension = 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.