Installing the Unity Ads SDK for Android
Download the Unity Ads framework, specifically
Create or open your existing Android project in Android Studio.
Add a new module and import the
unity-ads.aarfile. Name the module "unity-ads", for example.
Right-click the module in the project view, then select Open Module Settings > app, and add the "unity-ads" module as a dependency.
Add the following import to your java
If you can't use the
.aar packages with your build system, Unity also provides the same resources in a ZIP file (
unity-ads.zip in GitHub releases). Follow these steps to use Unity Ads:
classes.jarin your build.
Manually merge the manifest from
AndroidManifest.xml. Make sure you include both
AdUnitSoftwareActivityactivities. You also need to add the
If you are using ProGuard, add all lines from
proguard.txtto your ProGuard configuration.
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:
For more information, see the Google Play Console Help documentation on Advertising ID.