Integrating Early Access Builds of the Google Mobile Ads SDK into Unity Apps

This guide is intended for publishers integrating an early access build of the Google Mobile Ads SDK into their Unity app. Early access builds provide the opportunity to take advantage of new Google Mobile Ads SDK features without waiting for the next release, and they're fully tested and meet the same criteria for release as public builds.

Follow the steps below to integrate the early access build of the Google Mobile Ads SDK into your Unity app.

Prerequisites

  • Follow the Get Started guide to integrate the GMA Unity plugin into your Unity project.
  • You'll need early access builds of Google Mobile Ads SDK provided by your account manager.

Integration instructions

Click on a tab to select instructions for either Android or iOS. If you're integrating early access builds for both platforms, complete the instructions on both tabs.

Android

Download the early access build of the Google Mobile Ads Android SDK and unarchive it somewhere convenient.

Next, add this location as a custom Maven repository for the Google Mobile Ads Unity plugin, as described below.

Update the dependencies XML file

Update the contents of the XML file at Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml to the following:

<dependencies>
  <androidPackages>
    <androidPackage spec="com.google.android.gms:play-services-ads:x.y.z">
      <repositories>
        <repository>/path/to/extracted/maven/repo</repository>
        <repository>https://maven.google.com/</repository>
      </repositories>
    </androidPackage>
  </androidPackages>
</dependencies>

The bolded text, /path/to/extracted/maven/repo must be replaced with the path to the archived content of the early access Google Mobile Ads SDK zip file.

The dependency version, shown by x.y.z above, can be determined by finding the latest version present under the com/google/android/gms/play-services-ads/ directory in the unarchived contents of the Early Access Google Mobile Ads Android SDK zip file.

Force dependency resolution

In the Unity editor, select Assets > Play Services Resolver > Android Resolver > Force Resolve. The Unity Play Services Resolver library will perfrom dependency resolution from scratch and copy the declared dependencies into the Assets/Plugins/Android directory of your Unity app.

That's it. When you build your app, the JAR resolver will run and import all required dependencies into the build.

iOS

Make sure that the dependencies XML file at Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml has no references to the Google Mobile Ads SDK CocoaPod.

Next, remove any existing copies of the GoogleMobileAdsSDK that the JAR resolver has placed in your Assets/Plugins/iOS folder.

Download the early access build of the Google Mobile Ads iOS SDK and place its unarchived contents in the Assets/Plugins/iOS directory of your Unity project.

That's it. When you build your app, it will copy the framework to the iOS project.