Skip to content

The integration has two required lines: one Maven dependency in commonMain, and one initialization call at the root of the app that gathers consent and starts Mobile Ads in a single step. The full setup — version catalogs, the Gradle plugin, Kotlin/Native test linking, the iOS-only Info.plist keys, and the doctorIos check — lives in the Quickstart guide.

shared/build.gradle.kts
kotlin {
sourceSets {
commonMain.dependencies {
implementation("dev.avinya.ads:admob-cmp:1.1.0")
}
}
}
// commonMain — initialize once at the root
adManager.gatherConsentAndInitialize(
AdConfig(
androidAppId = TestAdIds.ANDROID_APP_ID,
iosAppId = TestAdIds.IOS_APP_ID,
testMode = true,
)
)

On iOS, the production ordering is UMP consent, then ATT tracking authorization, then initialize with ConsentMode.InitializeOnlyIfAlreadyAllowed. See the iOS setup guide for the two Swift Package Manager package URLs and the three Info.plist keys.

Continue to the full Quickstart →

Capability comparison

Comparison of admob-cmp against the basic-ads Compose Multiplatform ads library, with the public documentation snapshot dated 31 July 2026.

CapabilityAdMob CMPbasic-ads
Banner adsYesYes
Interstitial adsYesYes
Rewarded adsYesYes
Rewarded interstitial adsYesYes
App-open adsYesNot offered
Native adsYesNot offered
Native ad layout DSL and poolingadLayout {} plus NativeAdPool max-size accountingNot applicable
UMP consent inside initializationgatherConsentAndInitialize, three consent strategies, privacy-options formConsent request
iOS ATT orderingtracking authorization between consent and initializeNot documented
Paid and revenue eventsAdEvent.Paid with AdValue and ResponseInfoNot documented
Mediation adapter hooksAdInitializationHook at three initialization pointsNot documented
Kotlin/Native test linkingPublished dev.avinya.ads.admob-cmp Gradle pluginNot addressed
Generated API referenceYesYes
Maven Central publicationYesYes

Comparison verified on 31 July 2026 from the public documentation of both projects. "Not documented" here means that basic-ads' public documentation does not describe this capability; it is a statement about documentation coverage, not a judgement on the basic-ads maintainer. basic-ads is the older and larger project in this space and was the earlier publisher of a generated API reference for a Compose Multiplatform ads library. Corrections are welcome — please open an issue on GitHub.

Why this exists

Putting ads into a Compose Multiplatform app meant leaving Compose. The Google Mobile Ads SDKs are Android and iOS libraries with callback-based APIs, so the shared module ended up holding an expect/actual seam, two sets of platform glue, and a consent flow bolted on afterwards.

Samples and libraries already covered this ground, and they helped. What was still wanted was ads shaped like the rest of a Compose Multiplatform codebase: composables for the ad surfaces, suspend functions and StateFlow for the lifecycle, and consent gathered as part of initialization rather than as a step to remember.

So it was built inside an app that was being written, then extracted once the shape had settled. The APIs here are the ones that had to hold up on real screens: a native ad pool with max-size accounting, retry and cache behaviour with the numbers written down, and an iOS ordering — consent, then tracking authorization, then initialize — that the library sequences for you.

Compatibility and ordering

Kotlin
2.3.20
Compose Multiplatform
1.11.1
Android
minSdk 26
iOS
deployment target 15.0

The Kotlin klib does not promise binary compatibility across minor versions; re-resolve the klib when you bump the SDK.

Consent, ATT, and initialize sequence

Initialization order: UMP consent, then ATT, then initializeCLAUDE.md invariants #5, #11Read this diagram in words

Platform support matrix

Ad formats
FormatAndroid — GMA Next-Gen, API 26+iOS — GMA 13.x, iOS 15+Notes
Banner Supported SupportedAnchored adaptive, inline adaptive, fixed and fluid; collapsible on both platforms
Interstitial Supported SupportedTTL'd FIFO cache, 1 hour
Rewarded Supported SupportedRewardEarned event
Rewarded interstitial Supported SupportedSame controller shape as Rewarded
App-open Supported SupportedAppOpenAdCoordinator, cooldowns, blocking; cache TTL 4 hours
Native Supported SupportedadLayout DSL and pooling on both; iOS renders through UIKit
Cross-cutting capabilities
CapabilityAndroidiOSNotes
UMP consent and privacy-options form Supported SupportedcanRequestAds gates every request on both platforms
App Tracking Transparency Not applicable SupportedAndroid has no ATT: adManager.tracking always reports AdTrackingAuthorization.NotApplicable, and the AD_ID manifest permission governs the advertising id there instead
Mediation adapters Supported SupportedNo adapters are bundled; add the ones you need
Paid and revenue events Supported SupportedAdEvent.Paid carries AdValue and response info
Native video events Not available Supported — five eventsiOS emits VideoStarted, VideoPlayed, VideoPaused, VideoEnded and VideoMuted through GADVideoControllerDelegate. The Android GMA Next-Gen SDK exposes no equivalent callback surface on NativeAd, so Android emits none. This is an upstream SDK gap, not an admob-cmp omission — do not rely on native video events for cross-platform logic.
immersiveMode, customClickGesture, publisherProvidedId, categoryExclusions, skipUninitializedAdapters Supported Silently ignoredAndroid-only request options
customTargeting, placementId Supported SupportedMapped on both platforms; placementId maps to placementID on iOS
Platform support matrix: six formats on Android and iOSCLAUDE.md invariants #11Read this diagram in words

Roadmap

Swift Package Manager dependency import
Gated on four unmet upstream conditions (swiftPMDependencies); Maven-consumer propagation remains an open unknown and the project refuses to depend on an Alpha build-tool feature.
Native video events on Android
Blocked on the upstream SDK. iOS exposes GADVideoControllerDelegate with five video events; no equivalent Android callback surface is available.

Full roadmap →