Mopub Adapter Installation

Android Mopub Adapter Installation

Requirements

  • The Appnext MoPub Adapter supports Android 4.2+ when building for Android
  • The Appnext Native Ads SDK for Mopub supports MoPub 5.10 and above when building for Android
  • The Appnext MoPub Adapter must be implemented with the supported SDK version for it.
  • The Appnext MoPub Adapter requires internet access to pull ads information from your app

Adapter Integration

Latest version: 2.6.2.473 (released on July 05, 2021)

Using Gradle

Before updating a new SDK version, it is recommended to clear the Gradle cache and recompile the project.

Step 1: Define the root level gradle of the project.

You need to paste to the project gradle (Project integration App)

allprojects {
  repositories {
  maven { url "http://dl.appnext.com/" }
 }
}

Step 2: Define in the module build.gradle

You need to paste to the module gradle (Module App)

dependencies {
  implementation 'com.appnext.sdk.adapters:mopub-ads:2.+' // Mandatory for interstitial and fullscreen/rewarded video ad units
  implementation 'com.appnext.sdk.adapters:mopub-native-ads:2.+' // Mandatory for native ads ad unit
  implementation 'com.appnext.sdk.adapters:mopub-banners:2.+' // Mandatory for banners ad unit
  implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' // Mandatory
}

Base size (for all ad units): 241kb
Mopub ads size 210kb
Mopub native ads size 90kb
Mopub banners size 141kb

You're done! Go ahead and choose an ad unit to integrate with the adapter!

Manual Integration (Not Recommended)

Step 1: Download the ZIP file with the SDK and adapter AAR files

Download the AAR files from here
The ZIP file includes the following AAR files;

  • AppnextAndroidSDKCore.aar - The SDK core
  • AppnextAndroidSDKAds.aar - For the interstitial and fullscreen/rewarded ad units
  • AppnextAndroidSDKBanners.aar - For the banners ad unit
  • AppnextAndroidSDKNativeAds.aar - For the native ads ad unit
  • AppnextAndroidSDKActions.aar - For the actions ad unit
  • AppnextAndroidMopubAdapterAds.aar - The interstitial and fullscreen/rewarded ad units Mopub adapter
  • AppnextAndroidMopubAdapterBanners.aar - The banners ad unit Mopub adapter
  • AppnextAndroidMopubAdapterNativeAds.aar - The native ads ad unit Mopub adapter

Step 2: Add the AAR files into Your Project**

Extract the ZIP file and add the relevant AAR files to your "libs" folder in your project;

  • You must add the AppnextAndroidSDKCore.aar file (make sure to add it only once)
  • Add other AAR files according to your relevant ad unit integration
  • Add the relevant Mopub adapter AAR file accordingly
  • All AAR files must be from the same version (download the latest ZIP file to be sure)

Ad the following code to the project's build.gradle

allprojects {
   repositories {
      jcenter()
      flatDir {
        dirs 'libs'
      }
   }
}

Step 3: Add the following code to the module's build.gradle

For example, adding the Ads AAR with the adapter AAR file:

dependencies {
  implementation name:'AppnextAndroidSDKCore.aar', ext:'aar' // Mandatory
  implementation name:'AppnextAndroidSDKAds.aar', ext:'aar'
  implementation name:'AppnextAndroidMopubAdapterAds.aar', ext:'aar'
  implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' // Mandatory
}

Step 4: ProGuard

Exclude Appnext from your proguard by using the line:

-keep class com.appnext.** { *; }
-dontwarn com.appnext.**

You're done! Go ahead and choose an ad unit to integrate with the adapter!

Example Project

You can download an example project (Android Studio) from here.


What’s Next

Integrate one of the adapter's ad units