Import and configure the Unity Mediation SDK

If you are using a Gradle version earlier than Gradle 6.8, import the Unity Mediation SDK in your project by adding the artifactory as a maven repository to your Gradle project and following these steps.

  1. Open the root level build.gradle file in your project.

  2. Edit the repositories to add the maven artifactory location:

  3. Copy
    allprojects {
        repositories {
            google()
            mavenCentral()
            maven {
    url 'https://unity3ddist.jfrog.io/artifactory/unity-mediation-mvn-prod-local/'
            }
        }
    }

If you are using Gradle 6.8 and later, import the Unity Mediation SDK in your project by adding the repositories to settings.gradle. Go to the repositories section of dependencyResolutionManagement and adding the following:

Copy
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://unity3ddist.jfrog.io/artifactory/unity-mediation-mvn-prod-local/'
        }
    }
}

After you import the Unity Mediation SDK, import the adapters in your app’s build.gradle file. This step is the same regardless of which Gradle version you are using (prior to Gradle 6.8 or 6.8 and later).

  1. Open the build.gradle file in your project.

  2. Add the following implementations in the dependencies section of the file, ensuring the dependencies of the adapters you intend to use in your project are declared:

Copy
dependencies {
    ...
    implementation "com.unity3d.mediation:mediation-sdk:0.4.0"
    implementation "com.unity3d.mediation:unityads-adapter:0.4.3"
    implementation "com.unity3d.mediation:admob-adapter:0.4.0"
    implementation "com.unity3d.mediation:adcolony-adapter:0.4.0"
    implementation "com.unity3d.mediation:applovin-adapter:0.4.0"
    implementation "com.unity3d.mediation:facebook-adapter:0.4.0"
    implementation "com.unity3d.mediation:ironsource-adapter:0.4.0"  
    implementation "com.unity3d.mediation:vungle-adapter:0.4.0"
}

Import ad network adapters

To implement a third-party ad network adapter, you need to configure third-party ad networks as sources in your mediation setup in the Unity Dashboard.

Note: If you use Unity Ads exclusively, then no additional configuration is needed.

The following adapters require additional steps to function correctly in your app. If these requirements are not fulfilled, your app will not open and your builds will crash:

  • AdMob requires unique identifiers for each platform. You can locate these IDs in the AdMob dashboard, as detailed in the Ad Source Configuration guide

  • Unity Ads requires that you remove any previous installations of the Unity Ads SDK.