
Unified AdMob SDK exposing banner, interstitial, rewarded, rewarded interstitial, app-open and native ads via a single shared API; includes consent/ATT flow, adaptive banners, native layout DSL, revenue and mediation hooks.
Documentation · Install · Quickstart · Ad formats · Compatibility · Contributing · Sponsor
AdMob CMP is an open-source Kotlin Multiplatform AdMob SDK for Compose Multiplatform apps. Monetize Android and iOS from one commonMain API: banner, interstitial, rewarded, rewarded interstitial, app-open and native ads, with Google UMP consent for GDPR, App Tracking Transparency, mediation and paid events built in.
It wraps Google Mobile Ads Next-Gen on Android and Google Mobile Ads on iOS, so familiar AdMob concepts such as AdValue, ResponseInfo, adaptive banner sizes and UMP consent states carry over. You get suspend functions, StateFlow state and a sealed AdEvent stream. Coming from a hand-rolled expect class AdManager? Follow the migration guide.
[!NOTE] CMP means Compose Multiplatform here, not Consent Management Platform, although UMP consent is built in. The library is AdMob CMP, the repository is
admob-compose-multiplatform, and the Maven coordinate is, and will stay,dev.avinya.ads:admob-cmp.
All six formats, on both platforms, from one API. Select a format to open its guide.
| Format | AdFormat |
Controller (from AdManager) |
Composable | Test ad units |
|---|---|---|---|---|
| Banner (incl. collapsible) | AdFormat.Banner |
banner(placement) |
BannerAdView(placement) |
TestAdIds.ANDROID_BANNER / IOS_BANNER
|
| Interstitial | AdFormat.Interstitial |
interstitial(placement) |
— |
ANDROID_INTERSTITIAL / IOS_INTERSTITIAL
|
| Rewarded | AdFormat.Rewarded |
rewarded(placement) |
— |
ANDROID_REWARDED / IOS_REWARDED
|
| Rewarded interstitial | AdFormat.RewardedInterstitial |
rewardedInterstitial(placement) |
— |
ANDROID_REWARDED_INTERSTITIAL / IOS_REWARDED_INTERSTITIAL
|
| App-open | AdFormat.AppOpen |
appOpen(placement) + AppOpenAdCoordinator
|
— |
ANDROID_APP_OPEN / IOS_APP_OPEN
|
| Native | AdFormat.Native |
nativeAds.session(key, policy) |
NativeAdView(session, slotKey, placement, layout) |
ANDROID_NATIVE / IOS_NATIVE
|
1. Add the dependency to commonMain:
implementation("dev.avinya.ads:admob-cmp:2.8.0")2. Configure each platform. Google's SDKs need an app ID on both, and iOS also needs two Swift packages.
Put this inside <application> in the runnable app module, not in a shared library module:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" /> <!-- Google's sample ID: replace it -->Full guide: Android setup.
In Xcode, choose File → Add Package Dependencies and add both, with the rule Up to Next Major:
| Package | Product | Version |
|---|---|---|
https://github.com/googleads/swift-package-manager-google-mobile-ads.git |
GoogleMobileAds |
13.x |
https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git |
GoogleUserMessagingPlatform |
3.x |
With a static Kotlin framework, add -framework JavaScriptCore to Other Linker Flags. Then add these keys to Info.plist:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string> <!-- Google's sample ID: replace it -->
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalised ads to you.</string>
<key>SKAdNetworkItems</key>
<array><!-- The current list of identifiers from Google AdMob --></array>Full guide: iOS setup.
iosSimulatorArm64Test linksA Kotlin/Native test executable has no Xcode to resolve the Swift packages for it, so the link fails with Undefined symbols … _OBJC_CLASS_$_GAD*. The plugin links Google Mobile Ads and UMP into those test executables:
plugins {
id("dev.avinya.ads.admob-cmp") version "2.8.0"
}3. Verify the iOS integration with ./gradlew :admob-cmp-core:doctorIos. Stuck? Check Troubleshooting.
This runs against Google's official sample ad units, so it is safe to paste as-is.
@Composable
fun App() {
val adManager = rememberAdManager()
LaunchedEffect(Unit) {
adManager.gatherConsentAndInitialize(
AdConfig(
androidAppId = TestAdIds.ANDROID_APP_ID,
iosAppId = TestAdIds.IOS_APP_ID,
testMode = true
)
)
}
val placement = remember {
AdPlacement(
id = "main_interstitial",
format = AdFormat.Interstitial,
androidAdUnitId = TestAdIds.ANDROID_INTERSTITIAL,
iosAdUnitId = TestAdIds.IOS_INTERSTITIAL,
strictTestMode = true
)
}
val interstitial = remember(adManager) { adManager.interstitial(placement) }
val scope = rememberCoroutineScope()
Button(onClick = {
scope.launch {
interstitial.load()
interstitial.show()
}
}) { Text("Show ad") }
}The composable measures its own container and supplies the width, so adaptive sizing is correct even in iPad split view and Slide Over:
BannerAdView(
placement = AdPlacement(
id = "home_banner",
format = AdFormat.Banner,
androidAdUnitId = TestAdIds.ANDROID_BANNER,
iosAdUnitId = TestAdIds.IOS_BANNER
),
modifier = Modifier.fillMaxWidth()
)A feed reuses one placement id, keeps stable model-owned slot keys, and lets the session own native platform objects:
val nativePlacement = remember {
AdPlacement(
id = "feed_native",
format = AdFormat.Native,
androidAdUnitId = TestAdIds.ANDROID_NATIVE,
iosAdUnitId = TestAdIds.IOS_NATIVE,
)
}
val layout = remember {
adLayout {
column(modifier = AdModifier.fillMaxWidth()) {
media(modifier = AdModifier.fillMaxWidth().aspectRatio(16f / 9f))
headline(maxLines = 2)
body(maxLines = 3)
row(spacing = 8.dp) { icon(modifier = AdModifier.size(24.dp)); advertiser(); adBadge() }
callToAction(modifier = AdModifier.fillMaxWidth())
}
}
}
val session = rememberNativeAdFeedSession(
sessionKey = "feed",
listState = listState,
itemCount = feed.size,
slotAt = { index -> (feed[index] as? FeedItem.NativeSlot)?.let { NativeAdSlot(it.key, nativePlacement) } },
)
NativeAdView(session = session, slotKey = "after-article-3", placement = nativePlacement, layout = layout)Warning: Use a static, finite placement id and stable model-owned slot keys. Never generate either from a row index. The default active session retains three records; the process-wide governor bounds loaded plus reserved ads at soft 4 / hard 6. A temporary tab exit deactivates the session and retains one anchor; permanently discarded destinations close it. Per-placement native TTL remains one hour by default.
gatherConsentAndInitialize runs UMP consent and then the one-time SDK initialization. It does not request App Tracking Transparency on iOS: for that, use the consent → ATT → initialize order in the ATT guide. Gate ad-dependent UI on adManager.status.collectAsState() reaching AdManagerStatus.Ready.
|
All six formats, both platforms Native and app-open ads included, with a layout DSL and bounded, viewport-aware sessions. |
Consent is part of initialization UMP modes, the privacy options form and canRequestAds are first-class, and the iOS consent → ATT → initialize order is built in. |
|
The iOS test link works The Gradle plugin links Google Mobile Ads and UMP into Kotlin/Native test executables, so iosSimulatorArm64Test can pass. |
Revenue and mediation are exposed Paid events carry AdValue and ResponseInfo, and mediation adapters get initialization hooks. |
Test safety fails closedAdPlacement.strictTestMode throws at construction if a placement points at a production ad unit. Turn it on in debug builds. |
A stable API The public ABI is frozen and checked locally by ./scripts/release-readiness.sh, because CI does not run SDK or ABI verification. |
admob-cmp publishes Kotlin/Native klibs, which are not binary-compatible across arbitrary Kotlin versions. Build with a compatible compiler: patch versions are generally safe, but a different Kotlin minor version may fail to resolve the klib.
| admob-cmp | Kotlin | Compose Multiplatform | Android minSdk
|
iOS deployment target |
|---|---|---|---|---|
| 2.8.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
Underlying Google SDKs bound by 2.8.0:
| Google Mobile Ads, Android (Next-Gen) | Google Mobile Ads, iOS | User Messaging Platform, Android | User Messaging Platform, iOS |
|---|---|---|---|
| 1.4.0 | 13.9.0 | 4.0.0 | 3.1.0 |
| admob-cmp | Kotlin | Compose Multiplatform | Android minSdk
|
iOS deployment target |
|---|---|---|---|---|
| 2.6.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.5.1 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.5.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.4.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.3.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.2.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.1.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.0.1 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.0.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.1.1 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.1.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.0.2 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.0.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| Artifact | What it is |
|---|---|
dev.avinya.ads:admob-cmp |
The facade. This is the one to depend on. It brings in core and compose. |
dev.avinya.ads:admob-cmp-core |
Compose-free controller API. |
dev.avinya.ads:admob-cmp-compose |
BannerAdView, NativeAdView and rememberAdManager. |
dev.avinya.ads:admob-cmp-gradle-plugin |
Kotlin/Native test linking, applied by the dev.avinya.ads.admob-cmp plugin id. |
Compose Multiplatform is required only for the composable surface. The SDK is consumable from Kotlin Multiplatform / Gradle projects only: it compiles into the consumer's umbrella framework, so a pure-Swift iOS app cannot adopt it without a Kotlin Multiplatform shim.
showcase/ is a product-shaped Compose Multiplatform reference module. It exercises every ad format in real product flows: a chronological feed with interleaved native slots, section browsing, a rewarded coin economy, and an interstitial gated on natural transitions, plus an in-app SDK Lab and telemetry Inspector. Take the full tour.
showcase/ is currently a library module with its own test suite, not a launchable app. androidApp and iosApp embed the separate shared debug console, which exercises every format against Google's official sample ad units with strictTestMode validation on every placement.
./gradlew :androidApp:assembleDebug # Android
./gradlew :desktopApp:run # Desktop (no ads)
./gradlew :webApp:wasmJsBrowserDevelopmentRun # Web (no ads)
./gradlew :admob-cmp-core:testAndroidHostTest # JVM + Android-layer unit tests
./gradlew :admob-cmp-core:iosSimulatorArm64Test # iOS unit tests
./gradlew :admob-cmp-core:checkKotlinAbi # public API surface check
./gradlew :admob-cmp-core:doctorIos # diagnose iOS consumer integration
./gradlew :showcase:testAndroidHostTest :showcase:iosSimulatorArm64Test :showcase:compileKotlinIosSimulatorArm64 --no-configuration-cacheFor iOS, open iosApp/ in Xcode and run. Compose Multiplatform requires Xcode 26 (and the iOS 26 SDK) because of UIViewLayoutRegion linkage.
Guides, diagrams and the generated API reference live at ads.avinya.dev.
| Topic | Guides |
|---|---|
| Start | What is AdMob CMP? · Quickstart · Installation · Android setup · iOS setup · Migrate from expect/actual |
| Formats | Banner · Interstitial · Rewarded · App-open · Native |
| Privacy | UMP consent · App Tracking Transparency · Play Data safety |
| Advanced | Mediation · Revenue events · Caching, retry and timeouts · Test safety |
| Reference | API · Architecture · Compatibility · Troubleshooting · Changelog |
| Project | Roadmap · Contributing · Publishing |
Integrating with an AI coding agent? Point it at admob-cmp/AGENTS.md and https://ads.avinya.dev/llms.txt, the canonical machine-readable bundle of the full site. See Using with AI agents.
You're welcome here. Bug reports, documentation fixes, sample improvements and API feedback all help, and you don't need to be a Kotlin Multiplatform expert to send one.
| Have a question | Found a bug | Want a feature | Found a vulnerability |
|---|---|---|---|
| Start a discussion | Open a bug report | Request a feature | Report it privately |
Before opening a pull request, read CONTRIBUTING.md and run ./scripts/release-readiness.sh on macOS with Xcode 26. This repository runs no SDK tests in CI, by design, so verification is local. If you can't run the script, say so in the PR. Everyone here follows the Code of Conduct.
| Module | What it is |
|---|---|
admob-cmp/ |
The published facade artifact: depends on core and compose |
admob-cmp-core/ |
Compose-free Kotlin Multiplatform core: AdManager, consent, full-screen orchestration, banner and native-session coordination, iOS cinterop bindings |
admob-cmp-compose/ |
Compose Multiplatform UI: BannerAdView, NativeAdView, the native-ad layout DSL, the debug console, rememberAdManager
|
admob-cmp-gradle-plugin/ |
Links Google Mobile Ads and UMP into Kotlin/Native test executables |
shared/, androidApp/, iosApp/, desktopApp/, webApp/
|
The demo application. Ads render on the Android and iOS targets; desktop and web build without the ad surface. |
showcase/ |
Fieldnotes, the product-shaped reference module |
docs-site/ |
The Astro and Starlight source of ads.avinya.dev |
If AdMob CMP saves you time, a star helps other Kotlin Multiplatform developers find it.
AdMob CMP is free and Apache-2.0 licensed. Sponsorship pays for what keeps an ads SDK trustworthy: device certification on real hardware, and keeping pace with each Google Mobile Ads and UMP release. If your company ships it in production, talk to Avinya about sponsoring or priority support.
Not sponsoring? Starring the repo, sharing it with another KMP developer, or writing about your integration helps just as much.
Apache License 2.0. Built by Avinya.
Not affiliated with or endorsed by Google. AdMob and Google Mobile Ads are trademarks of Google LLC.
Documentation · Install · Quickstart · Ad formats · Compatibility · Contributing · Sponsor
AdMob CMP is an open-source Kotlin Multiplatform AdMob SDK for Compose Multiplatform apps. Monetize Android and iOS from one commonMain API: banner, interstitial, rewarded, rewarded interstitial, app-open and native ads, with Google UMP consent for GDPR, App Tracking Transparency, mediation and paid events built in.
It wraps Google Mobile Ads Next-Gen on Android and Google Mobile Ads on iOS, so familiar AdMob concepts such as AdValue, ResponseInfo, adaptive banner sizes and UMP consent states carry over. You get suspend functions, StateFlow state and a sealed AdEvent stream. Coming from a hand-rolled expect class AdManager? Follow the migration guide.
[!NOTE] CMP means Compose Multiplatform here, not Consent Management Platform, although UMP consent is built in. The library is AdMob CMP, the repository is
admob-compose-multiplatform, and the Maven coordinate is, and will stay,dev.avinya.ads:admob-cmp.
All six formats, on both platforms, from one API. Select a format to open its guide.
| Format | AdFormat |
Controller (from AdManager) |
Composable | Test ad units |
|---|---|---|---|---|
| Banner (incl. collapsible) | AdFormat.Banner |
banner(placement) |
BannerAdView(placement) |
TestAdIds.ANDROID_BANNER / IOS_BANNER
|
| Interstitial | AdFormat.Interstitial |
interstitial(placement) |
— |
ANDROID_INTERSTITIAL / IOS_INTERSTITIAL
|
| Rewarded | AdFormat.Rewarded |
rewarded(placement) |
— |
ANDROID_REWARDED / IOS_REWARDED
|
| Rewarded interstitial | AdFormat.RewardedInterstitial |
rewardedInterstitial(placement) |
— |
ANDROID_REWARDED_INTERSTITIAL / IOS_REWARDED_INTERSTITIAL
|
| App-open | AdFormat.AppOpen |
appOpen(placement) + AppOpenAdCoordinator
|
— |
ANDROID_APP_OPEN / IOS_APP_OPEN
|
| Native | AdFormat.Native |
nativeAds.session(key, policy) |
NativeAdView(session, slotKey, placement, layout) |
ANDROID_NATIVE / IOS_NATIVE
|
1. Add the dependency to commonMain:
implementation("dev.avinya.ads:admob-cmp:2.8.0")2. Configure each platform. Google's SDKs need an app ID on both, and iOS also needs two Swift packages.
Put this inside <application> in the runnable app module, not in a shared library module:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" /> <!-- Google's sample ID: replace it -->Full guide: Android setup.
In Xcode, choose File → Add Package Dependencies and add both, with the rule Up to Next Major:
| Package | Product | Version |
|---|---|---|
https://github.com/googleads/swift-package-manager-google-mobile-ads.git |
GoogleMobileAds |
13.x |
https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git |
GoogleUserMessagingPlatform |
3.x |
With a static Kotlin framework, add -framework JavaScriptCore to Other Linker Flags. Then add these keys to Info.plist:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string> <!-- Google's sample ID: replace it -->
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalised ads to you.</string>
<key>SKAdNetworkItems</key>
<array><!-- The current list of identifiers from Google AdMob --></array>Full guide: iOS setup.
iosSimulatorArm64Test linksA Kotlin/Native test executable has no Xcode to resolve the Swift packages for it, so the link fails with Undefined symbols … _OBJC_CLASS_$_GAD*. The plugin links Google Mobile Ads and UMP into those test executables:
plugins {
id("dev.avinya.ads.admob-cmp") version "2.8.0"
}3. Verify the iOS integration with ./gradlew :admob-cmp-core:doctorIos. Stuck? Check Troubleshooting.
This runs against Google's official sample ad units, so it is safe to paste as-is.
@Composable
fun App() {
val adManager = rememberAdManager()
LaunchedEffect(Unit) {
adManager.gatherConsentAndInitialize(
AdConfig(
androidAppId = TestAdIds.ANDROID_APP_ID,
iosAppId = TestAdIds.IOS_APP_ID,
testMode = true
)
)
}
val placement = remember {
AdPlacement(
id = "main_interstitial",
format = AdFormat.Interstitial,
androidAdUnitId = TestAdIds.ANDROID_INTERSTITIAL,
iosAdUnitId = TestAdIds.IOS_INTERSTITIAL,
strictTestMode = true
)
}
val interstitial = remember(adManager) { adManager.interstitial(placement) }
val scope = rememberCoroutineScope()
Button(onClick = {
scope.launch {
interstitial.load()
interstitial.show()
}
}) { Text("Show ad") }
}The composable measures its own container and supplies the width, so adaptive sizing is correct even in iPad split view and Slide Over:
BannerAdView(
placement = AdPlacement(
id = "home_banner",
format = AdFormat.Banner,
androidAdUnitId = TestAdIds.ANDROID_BANNER,
iosAdUnitId = TestAdIds.IOS_BANNER
),
modifier = Modifier.fillMaxWidth()
)A feed reuses one placement id, keeps stable model-owned slot keys, and lets the session own native platform objects:
val nativePlacement = remember {
AdPlacement(
id = "feed_native",
format = AdFormat.Native,
androidAdUnitId = TestAdIds.ANDROID_NATIVE,
iosAdUnitId = TestAdIds.IOS_NATIVE,
)
}
val layout = remember {
adLayout {
column(modifier = AdModifier.fillMaxWidth()) {
media(modifier = AdModifier.fillMaxWidth().aspectRatio(16f / 9f))
headline(maxLines = 2)
body(maxLines = 3)
row(spacing = 8.dp) { icon(modifier = AdModifier.size(24.dp)); advertiser(); adBadge() }
callToAction(modifier = AdModifier.fillMaxWidth())
}
}
}
val session = rememberNativeAdFeedSession(
sessionKey = "feed",
listState = listState,
itemCount = feed.size,
slotAt = { index -> (feed[index] as? FeedItem.NativeSlot)?.let { NativeAdSlot(it.key, nativePlacement) } },
)
NativeAdView(session = session, slotKey = "after-article-3", placement = nativePlacement, layout = layout)Warning: Use a static, finite placement id and stable model-owned slot keys. Never generate either from a row index. The default active session retains three records; the process-wide governor bounds loaded plus reserved ads at soft 4 / hard 6. A temporary tab exit deactivates the session and retains one anchor; permanently discarded destinations close it. Per-placement native TTL remains one hour by default.
gatherConsentAndInitialize runs UMP consent and then the one-time SDK initialization. It does not request App Tracking Transparency on iOS: for that, use the consent → ATT → initialize order in the ATT guide. Gate ad-dependent UI on adManager.status.collectAsState() reaching AdManagerStatus.Ready.
|
All six formats, both platforms Native and app-open ads included, with a layout DSL and bounded, viewport-aware sessions. |
Consent is part of initialization UMP modes, the privacy options form and canRequestAds are first-class, and the iOS consent → ATT → initialize order is built in. |
|
The iOS test link works The Gradle plugin links Google Mobile Ads and UMP into Kotlin/Native test executables, so iosSimulatorArm64Test can pass. |
Revenue and mediation are exposed Paid events carry AdValue and ResponseInfo, and mediation adapters get initialization hooks. |
Test safety fails closedAdPlacement.strictTestMode throws at construction if a placement points at a production ad unit. Turn it on in debug builds. |
A stable API The public ABI is frozen and checked locally by ./scripts/release-readiness.sh, because CI does not run SDK or ABI verification. |
admob-cmp publishes Kotlin/Native klibs, which are not binary-compatible across arbitrary Kotlin versions. Build with a compatible compiler: patch versions are generally safe, but a different Kotlin minor version may fail to resolve the klib.
| admob-cmp | Kotlin | Compose Multiplatform | Android minSdk
|
iOS deployment target |
|---|---|---|---|---|
| 2.8.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
Underlying Google SDKs bound by 2.8.0:
| Google Mobile Ads, Android (Next-Gen) | Google Mobile Ads, iOS | User Messaging Platform, Android | User Messaging Platform, iOS |
|---|---|---|---|
| 1.4.0 | 13.9.0 | 4.0.0 | 3.1.0 |
| admob-cmp | Kotlin | Compose Multiplatform | Android minSdk
|
iOS deployment target |
|---|---|---|---|---|
| 2.6.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.5.1 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.5.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.4.0 | 2.4.20 | 1.12.0 | 26 | 15.0 |
| 2.3.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.2.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.1.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.0.1 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 2.0.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.1.1 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.1.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.0.2 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| 1.0.0 | 2.3.20 | 1.11.1 | 26 | 15.0 |
| Artifact | What it is |
|---|---|
dev.avinya.ads:admob-cmp |
The facade. This is the one to depend on. It brings in core and compose. |
dev.avinya.ads:admob-cmp-core |
Compose-free controller API. |
dev.avinya.ads:admob-cmp-compose |
BannerAdView, NativeAdView and rememberAdManager. |
dev.avinya.ads:admob-cmp-gradle-plugin |
Kotlin/Native test linking, applied by the dev.avinya.ads.admob-cmp plugin id. |
Compose Multiplatform is required only for the composable surface. The SDK is consumable from Kotlin Multiplatform / Gradle projects only: it compiles into the consumer's umbrella framework, so a pure-Swift iOS app cannot adopt it without a Kotlin Multiplatform shim.
showcase/ is a product-shaped Compose Multiplatform reference module. It exercises every ad format in real product flows: a chronological feed with interleaved native slots, section browsing, a rewarded coin economy, and an interstitial gated on natural transitions, plus an in-app SDK Lab and telemetry Inspector. Take the full tour.
showcase/ is currently a library module with its own test suite, not a launchable app. androidApp and iosApp embed the separate shared debug console, which exercises every format against Google's official sample ad units with strictTestMode validation on every placement.
./gradlew :androidApp:assembleDebug # Android
./gradlew :desktopApp:run # Desktop (no ads)
./gradlew :webApp:wasmJsBrowserDevelopmentRun # Web (no ads)
./gradlew :admob-cmp-core:testAndroidHostTest # JVM + Android-layer unit tests
./gradlew :admob-cmp-core:iosSimulatorArm64Test # iOS unit tests
./gradlew :admob-cmp-core:checkKotlinAbi # public API surface check
./gradlew :admob-cmp-core:doctorIos # diagnose iOS consumer integration
./gradlew :showcase:testAndroidHostTest :showcase:iosSimulatorArm64Test :showcase:compileKotlinIosSimulatorArm64 --no-configuration-cacheFor iOS, open iosApp/ in Xcode and run. Compose Multiplatform requires Xcode 26 (and the iOS 26 SDK) because of UIViewLayoutRegion linkage.
Guides, diagrams and the generated API reference live at ads.avinya.dev.
| Topic | Guides |
|---|---|
| Start | What is AdMob CMP? · Quickstart · Installation · Android setup · iOS setup · Migrate from expect/actual |
| Formats | Banner · Interstitial · Rewarded · App-open · Native |
| Privacy | UMP consent · App Tracking Transparency · Play Data safety |
| Advanced | Mediation · Revenue events · Caching, retry and timeouts · Test safety |
| Reference | API · Architecture · Compatibility · Troubleshooting · Changelog |
| Project | Roadmap · Contributing · Publishing |
Integrating with an AI coding agent? Point it at admob-cmp/AGENTS.md and https://ads.avinya.dev/llms.txt, the canonical machine-readable bundle of the full site. See Using with AI agents.
You're welcome here. Bug reports, documentation fixes, sample improvements and API feedback all help, and you don't need to be a Kotlin Multiplatform expert to send one.
| Have a question | Found a bug | Want a feature | Found a vulnerability |
|---|---|---|---|
| Start a discussion | Open a bug report | Request a feature | Report it privately |
Before opening a pull request, read CONTRIBUTING.md and run ./scripts/release-readiness.sh on macOS with Xcode 26. This repository runs no SDK tests in CI, by design, so verification is local. If you can't run the script, say so in the PR. Everyone here follows the Code of Conduct.
| Module | What it is |
|---|---|
admob-cmp/ |
The published facade artifact: depends on core and compose |
admob-cmp-core/ |
Compose-free Kotlin Multiplatform core: AdManager, consent, full-screen orchestration, banner and native-session coordination, iOS cinterop bindings |
admob-cmp-compose/ |
Compose Multiplatform UI: BannerAdView, NativeAdView, the native-ad layout DSL, the debug console, rememberAdManager
|
admob-cmp-gradle-plugin/ |
Links Google Mobile Ads and UMP into Kotlin/Native test executables |
shared/, androidApp/, iosApp/, desktopApp/, webApp/
|
The demo application. Ads render on the Android and iOS targets; desktop and web build without the ad surface. |
showcase/ |
Fieldnotes, the product-shaped reference module |
docs-site/ |
The Astro and Starlight source of ads.avinya.dev |
If AdMob CMP saves you time, a star helps other Kotlin Multiplatform developers find it.
AdMob CMP is free and Apache-2.0 licensed. Sponsorship pays for what keeps an ads SDK trustworthy: device certification on real hardware, and keeping pace with each Google Mobile Ads and UMP release. If your company ships it in production, talk to Avinya about sponsoring or priority support.
Not sponsoring? Starring the repo, sharing it with another KMP developer, or writing about your integration helps just as much.
Apache License 2.0. Built by Avinya.
Not affiliated with or endorsed by Google. AdMob and Google Mobile Ads are trademarks of Google LLC.