Installing the Unity Ads SDK for Android

Download the Unity Ads framework, specifically unity-ads.aar.

Using Android Studio

  1. Create or open your existing Android project in Android Studio.

  2. Add a new module and import the unity-ads.aar file. Name the module "unity-ads", for example.

  3. Right-click the module in the project view, then select Open Module Settings > app, and add the "unity-ads" module as a dependency.

  4. Add the following import to your java Activity file:


Without Android Studio

If you can't use the .aar packages with your build system, Unity also provides the same resources in a ZIP file ( in GitHub releases). Follow these steps to use Unity Ads:

  1. Include classes.jar in your build.

  2. Manually merge the manifest from AndroidManifest.xml. Make sure you include both AdUnitActivity and AdUnitSoftwareActivity activities. You also need to add the INTERNET and ACCESS_NETWORK_STATE permissions.

  3. If you are using ProGuard, add all lines from proguard.txt to your ProGuard configuration.

Advertising ID

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=""/>

Important: Google will enforce this declaration beginning April 1, 2022.

For more information, see the Google Play Console Help documentation on Advertising ID.

Next steps: To continue your integration, see Initializing the SDK in Android.