Skip to main content

Install & configure Android SDK

Adapty SDK includes two key modules for seamless integration into your mobile app:

  • Core Adapty: This essential SDK is required for Adapty to function properly in your app.
  • AdaptyUI: This module is needed if you use the Adapty Paywall Builder, a user-friendly, no-code tool for easily creating cross-platform paywalls.
tip

Want to see a real-world example of how Adapty SDK is integrated into a mobile app? Check out our sample app, which demonstrates the full setup, including displaying paywalls, making purchases, and other basic functionality.

info

Adapty supports Google Play Billing Library up to 7.x. Support for Billing Library 8.0.0 (released 30 June, 2025) is planned.

Install Adapty SDK

Choose your dependency setup method:

  • Standard Gradle: Add dependencies to your module-level build.gradle
  • If your project uses .gradle.kts files, add dependencies to your module-level build.gradle.kts
  • If you use version catalogs, add dependencies to your libs.versions.toml file and then, reference it in build.gradle.kts

Release

dependencies {
...
implementation platform('io.adapty:adapty-bom:<the latest SDK version>')
implementation 'io.adapty:android-sdk'

// Only add this line if you plan to use Paywall Builder
implementation 'io.adapty:android-ui'
}

If the dependency is not being resolved, please make sure that you have mavenCentral() in your Gradle scripts.

The instruction on how to add it

If your project doesn't have dependencyResolutionManagement in your settings.gradle, add the following to your top-level build.gradle at the end of repositories:

top-level build.gradle
allprojects {
repositories {
...
mavenCentral()
}
}

Otherwise, add the following to your settings.gradle in repositories of dependencyResolutionManagement section:

settings.gradle
dependencyResolutionManagement {
...
repositories {
...
mavenCentral()
}
}

Activate Adapty module of Adapty SDK

Basic setup

// In your Application class
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Adapty.activate(
applicationContext,
AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.build()
)
}
}

To get your Public SDK Key:

  1. Go to Adapty Dashboard and navigate to App settings → General.
  2. From the Api keys section, copy the Public SDK Key (NOT the Secret Key).
  3. Replace "YOUR_PUBLIC_SDK_KEY" in the code.
important
  • Make sure you use the Public SDK key for Adapty initialization, the Secret key should be used for server-side API only.
  • SDK keys are unique for every app, so if you have multiple apps make sure you choose the right one.

Activate AdaptyUI module of Adapty SDK

If you plan to use Paywall Builder and have installed AdaptyUI module, you also need to activate AdaptyUI:

important

In your code, you must activate the core Adapty module before activating AdaptyUI.

Kotlin
import com.adapty.ui.AdaptyUI

AdaptyUI.activate()
Java
import com.adapty.ui.AdaptyUI;

AdaptyUI.activate();

Configure Proguard

Before launching your app in the production, add -keep class com.adapty.** { *; } to your Proguard configuration.

Optional setup

Logging

Set up the logging system

Adapty logs errors and other important information to help you understand what is going on. There are the following levels available:

LevelDescription
AdaptyLogLevel.NONENothing will be logged. Default value
AdaptyLogLevel.ERROROnly errors will be logged
AdaptyLogLevel.WARNErrors and messages from the SDK that do not cause critical errors, but are worth paying attention to will be logged.
AdaptyLogLevel.INFOErrors, warnings, and various information messages will be logged.
AdaptyLogLevel.VERBOSEAny additional information that may be useful during debugging, such as function calls, API queries, etc. will be logged.

You can set the log level in your app before configuring Adapty.

Adapty.logLevel = AdaptyLogLevel.VERBOSE 
//recommended for development and the first production release

Redirect the logging system messages

If you for some reason need to send messages from Adapty to your system or save them to a file, you can override the default behavior:

Adapty.setLogHandler { level, message ->
//handle the log
}

Data policies

Adapty doesn't store personal data of your users unless you explicitly send it, but you can implement additional data security policies to comply with the store or country guidelines.

Disable IP address collection and sharing

When activating the Adapty module, set ipAddressCollectionDisabled to true to disable user IP address collection and sharing. The default value is false.

Use this parameter to enhance user privacy, comply with regional data protection regulations (like GDPR or CCPA), or reduce unnecessary data collection when IP-based features aren't required for your app.

AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.withIpAddressCollectionDisabled(true)
.build()

Disable advertising ID (Ad ID) collection and sharing

When activating the Adapty module, set adIdCollectionDisabled to true to disable the collection of the user advertising ID. The default value is false.

Use this parameter to comply with Play Store policies, avoid triggering the advertising ID permission prompt, or if your app does not require advertising attribution or analytics based on Ad ID.

AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.withAdIdCollectionDisabled(true)
.build()

Set up media cache configuration for AdaptyUI

By default, AdaptyUI caches media (such as images and videos) to improve performance and reduce network usage. You can customize the cache settings by providing a custom configuration.

Use AdaptyUI.configureMediaCache to override the default cache size and validity period. This is optional—if you don't call this method, default values will be used (100MB disk size, 7 days validity).

import com.adapty.ui.AdaptyUI
import com.adapty.ui.AdaptyUI.MediaCacheConfiguration

val cacheConfig = MediaCacheConfiguration.Builder()
.overrideDiskStorageSizeLimit(200L * 1024 * 1024) // 200 MB
.overrideDiskCacheValidityTime(3.days)
.build()

AdaptyUI.configureMediaCache(cacheConfig)

Parameters:

ParameterPresenceDescription
diskStorageSizeLimitoptionalTotal cache size on disk in bytes. Default is 100 MB.
diskCacheValidityTimeoptionalHow long cached files are considered valid. Default is 7 days.
tip

You can clear the media cache at runtime using AdaptyUI.clearMediaCache(strategy), where strategy can be CLEAR_ALL or CLEAR_EXPIRED_ONLY.