en-us-ads-android-4-dot-19-dot-0-sdk-integration-install-sdk.md
Install the Unity Ads SDK in your Android project. Add the required dependencies to your build.gradle files and sync the build to apply the changes.
Read time 1 minute
Last updated 3 days ago
You can use Gradle dependencies to integrate the Unity Ads SDK. Unity supports Android 4.4 "KitKat" (API level 19) and later.
Note
Unity Ads has new dependencies from SDK version 4.5.0. Manually including the linked aar file (which contains all metadata, Android manifest, classes.jar, proguard rules, and so on) will lead to runtime errors if dependencies are not properly resolved. The recommended best practice is to use a package management system such as Gradle to handle dependency management. Refer to the Android SDK integration steps for details.
Important
Java 8+ targeting will be required from the Unity Ads SDK version 4.7.0 and higher.
dependencies
section to your app-level build.gradle file:
JavaKotlin
dependencies { implementation 'com.unity3d.ads:unity-ads:4.19.0'}
dependencies { implementation("com.unity3d.ads:unity-ads:4.19.0")}
compileOptions
section:
JavaKotlin
android { compileOptions { sourceCompatibility = JavaVersion.VERSION\_1\_8 targetCompatibility = JavaVersion.VERSION\_1\_8 }}
android { compileOptions { sourceCompatibility(JavaVersion.VERSION\_1\_8) targetCompatibility(JavaVersion.VERSION\_1\_8) }}
Note
If your app uses the Unity Ads SDK version 4.1 or later, you can skip this step because the SDK automatically declares the permission and can access the Advertising ID whenever it is available. Apps using the Unity Ads SDK version 4.0.1 or earlier must include the declaration manually.
When an Android user opts out of interest-based advertising or ads personalization, the advertising identifier will not be available. Publishers will receive a string of zeros in place of the identifier.Additionally, when apps update their target to Android 13 or later, they need to declare a Google Play services normal permission in the manifest file as follows:
\<uses-permission android:name="com.google.android.gms.permission.AD\_ID"/\>
Important
Google will enforce this declaration beginning April 1, 2022. For more information, refer to the Google Play Console Help documentation on Advertising ID.
Next steps : To continue your integration, refer to the Initialize the SDK in Android documentation.