This page shows you how to download, configure, and initialize the AppLovin MAX SDK.
Java 8 will be required in an upcoming SDK release.
Download the Latest SDK ()
You can download the SDK through Gradle as a dependency. If you prefer to integrate manually, follow the Manual Download for MAX Mediation Networks instructions.
Gradle (Recommended)
Add the following to your app-level build.gradle file:
-
repositories { google() mavenCentral() ⋮ } dependencies { implementation 'com.applovin:applovin-sdk:+' ⋮ }
-
repositories { google() mavenCentral() ⋮ } dependencies { implementation("com.applovin:applovin-sdk:+") ⋮ }
If your project is not using Java 8+, set your Java version to 8 in build.gradle:
-
android { compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } }
-
android { compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } }
The SDK collects the Google Advertising ID, which requires the Android Advertising ID (AAID) module (com.google.android.gms:play-services-ads-identifier
).
The com.google.android.gms.permission.AD_ID
permission is included by default starting in version 11.4.5 of AppLovin Android SDK.
If you want to receive release updates, subscribe to the AppLovin-MAX-SDK-Android GitHub repository.
The AppLovin SDK requires that you set minSdkVersion
to 16 or above.
Add the SDK Key
Add the following <meta-data>
element to your AndroidManifest.xml, inside the <application>
element:
<meta-data android:name="applovin.sdk.key" android:value="sdk-key"/>
You can find your SDK key in the Account > General > Keys section of the AppLovin dashboard.
Enable Ad Review
To enable the MAX Ad Review service, add the following to your build.gradle files:
Additions to Root-Level build.gradle File
-
buildscript { repositories { maven { url 'https://artifacts.applovin.com/android' } } dependencies { classpath "com.applovin.quality:AppLovinQualityServiceGradlePlugin:+" } }
-
buildscript { repositories { maven { url = uri("https://artifacts.applovin.com/android") } } dependencies { classpath ("com.applovin.quality:AppLovinQualityServiceGradlePlugin:+") } }
Additions to App-Level build.gradle File
-
apply plugin: 'applovin-quality-service' applovin { apiKey "ad-review-key" }
-
plugins { id("applovin-quality-service") } applovin { apiKey = "ad-review-key" }
You can find your Ad Review Key in the Account > General > Keys section of the AppLovin dashboard.
Initialize the SDK
Initialize the SDK by calling the initializeSdk()
method, passing that method a context. Do this as soon as possible after your app starts, for example in the onCreate()
method of your launch Activity
.
Ad assets that are fully cached result in a better user experience. Therefore, always initialize the AppLovin SDK on startup so as to give mediated networks the maximum amount of time to cache ads. This is especially important with video ads.
Do not use different network app IDs for the same network across different ad units. If you use different app IDs for the same network and app package name without using selective init you will break the network initialization process.
-
public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { // Make sure to set the mediation provider value to "max" to ensure proper functionality AppLovinSdk.getInstance( context ).setMediationProvider( "max" ); AppLovinSdk.initializeSdk( context, new AppLovinSdk.SdkInitializationListener() { @Override public void onSdkInitialized(final AppLovinSdkConfiguration configuration) { // AppLovin SDK is initialized, start loading ads } } ); } }
-
class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { // Make sure to set the mediation provider value to "max" to ensure proper functionality AppLovinSdk.getInstance( context ).setMediationProvider( "max" ) AppLovinSdk.getInstance( context ).initializeSdk({ configuration: AppLovinSdkConfiguration -> // AppLovin SDK is initialized, start loading ads }) } }
ProGuard Rules
If you use ProGuard, note that the AppLovin MAX SDK and adapters come bundled with the required ProGuard rules in the AARs. Therefore, you do not need to add any additional ProGuard rules to your project.