Google 移动广告 SDK 精简版

Like any Android library, the Google Play services SDK increases the size of apps that include it. The Google Mobile Ads Lite SDK is a lightweight version of the Google Mobile Ads SDK built to reduce that impact. It is a fraction of the size of the regular SDK.

Alongside reduced size, using the Lite SDK decreases the total number of methods referenced in an app. This is especially useful when deploying to older versions of Android, where developers can run into the 64K reference limit.

Here's how to configure gradle to incorporate the Lite SDK into your app:

dependencies {
    implementation 'com.google.android.gms:play-services-ads-lite:23.0.0'
}

Limitations of the Lite SDK

The Lite SDK should only be used in apps distributed through the Google Play store.

Unlike other Google Play services, the standard Google Mobile Ads SDK implementation in the Google Play services APK is also included in the Google Play services client library. This allows for support on devices without the Google Play services APK. At runtime, the SDK will compare the versions of the client library and the Google Play services APK and use the newer version.

The Lite SDK strips the Google Mobile Ads SDK implementation from the client library, leaving only an interface to the Google Play services APK. The Lite SDK relies on the implementation of the APK. If you deploy your app outside of the Google Play store, it is not guaranteed that your user's devices will have the Google Play services APK installed.

On devices with an up-to-date version of Google Play services, the Lite SDK's behavior is identical to that of the standard SDK. However, on devices where Google Play services is outdated or not present, the Lite SDK may reference APIs that are unavailable or have been changed from those in the Google Play services APK. This will result in a no-op and an error being logged, which may cause ads not to serve to those devices.