跳转到内容

Integration

此内容尚不支持你的语言。

This page shows you how to download, import, and configure the AppLovin MAX SDK.

Download the Latest SDK

You can download the SDK through Gradle as a dependency. If you prefer to integrate manually, follow the instructions here.

The SDK requires the minSdkVersion to be 16 or above.

To receive release updates, subscribe to the AppLovin Android MAX SDK GitHub repository.

Gradle

Add the following to your app-level build.gradle file:

repositories {
google()
mavenCentral()
}
dependencies {
implementation 'com.applovin:applovin-sdk:+'
}

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.

Add the SDK Key

Add the following <meta-data> element to your AndroidManifest.xml. Place it 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.

Integrate Custom SDK Adapters

AppLovin Exchange (ALX) supports a custom adapter for LinkedIn. Integration instructions are below, and more information can be found here.

To install the adapter, add the following to your app-level build.gradle file:

dependencies {
implementation 'com.applovin.dsp:linkedin-adapter:+'
}

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:+"
}
}

Additions to App-Level build.gradle File

apply plugin: '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. Pass 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. For this reason, always initialize the AppLovin SDK on startup. This gives mediated networks the maximum amount of time to cache ads. This is especially important with video ads.

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
}
} );
}
}