Install GMA Next-Gen SDK

To adopt Android latency and stability improvements, use GMA Next-Gen SDK. This guide covers configuring Google Mobile Ads Unity Plugin to use GMA Next-Gen SDK for Android.

Prerequisites

Before you continue, do the following:

Update minimum API level to 24

GMA Next-Gen SDK requires a minimum API level of 24. To update the minimum API level, do the following:

  1. From the menu bar, click File > Build Profiles > Player Settings > Android > Other Settings > Identification.
  2. Set Minimum API Level to Android 7.0 'Nougat' (API Level 24) or higher.

Modify the dependency file

To enable GMA Next-Gen SDK for your Android builds, do the following:

  1. In your Unity project, navigate to the Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml file.

    • If you use Unity Package Manager, navigate to Packages > Google Mobile Ads for Unity > GoogleMobileAds > Editor > GoogleMobileAdsDependencies.xml.
  2. Locate the <androidPackage> element with spec com.google.android.gms:play-services-ads.

  3. Replace the element with the latest available version of com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:

    <androidPackage spec="com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:0.24.0-beta01">
      <repositories>
        <repository>https://maven.google.com/</repository>
      </repositories>
    </androidPackage>
    
  4. Save the file.

During the build process, Google Mobile Ads Unity Plugin detects the presence of GMA Next-Gen SDK and uses your implementation.

View the full example

The following example shows the updated GoogleMobileAdsDependencies.xml file:

<dependencies>
  <androidPackages>
    <androidPackage spec="com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:0.24.0-beta01">
      <repositories>
        <repository>https://maven.google.com/</repository>
      </repositories>
    </androidPackage>
    <androidPackage spec="androidx.constraintlayout:constraintlayout:2.1.4">
      <repositories>
        <repository>https://maven.google.com/</repository>
      </repositories>
    </androidPackage>
    <androidPackage spec="androidx.lifecycle:lifecycle-process:2.6.2">
        <repositories>
            <repository>https://maven.google.com/</repository>
        </repositories>
    </androidPackage>
  </androidPackages>

  <iosPods>
    <iosPod name="Google-Mobile-Ads-SDK" version="~> 12.11.0">
      <sources>
        <source>https://github.com/CocoaPods/Specs</source>
      </sources>
    </iosPod>
  </iosPods>
</dependencies>