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.
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.
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-levelbuild.gradle.kts
- If you use version catalogs, add dependencies to your
libs.versions.toml
file and then, reference it inbuild.gradle.kts
- module-level build.gradle
- module-level build.gradle.kts
- version catalog
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'
}
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")
}
//libs.versions.toml
[versions]
..
adaptyBom = "<the latest SDK version>"
[libraries]
..
adapty-bom = { module = "io.adapty:adapty-bom", version.ref = "adaptyBom" }
adapty = { module = "io.adapty:android-sdk" }
// Only add this line if you plan to use Paywall Builder:
adapty-ui = { module = "io.adapty:android-ui" }
//module-level build.gradle.kts
dependencies {
...
implementation(platform(libs.adapty.bom))
implementation(libs.adapty)
// Only add this line if you plan to use Paywall Builder:
implementation(libs.adapty.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:
allprojects {
repositories {
...
mavenCentral()
}
}
Otherwise, add the following to your settings.gradle
in repositories
of dependencyResolutionManagement
section:
dependencyResolutionManagement {
...
repositories {
...
mavenCentral()
}
}
Activate Adapty module of Adapty SDK
Basic setup
- Kotlin
- Java
// In your Application class
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Adapty.activate(
applicationContext,
AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.build()
)
}
}
// In your Application class
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Adapty.activate(
getApplicationContext(),
new AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.build()
);
}
}
To get your Public SDK Key:
- Go to Adapty Dashboard and navigate to App settings → General.
- From the Api keys section, copy the Public SDK Key (NOT the Secret Key).
- Replace
"YOUR_PUBLIC_SDK_KEY"
in the code.
- 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:
In your code, you must activate the core Adapty module before activating AdaptyUI.
import com.adapty.ui.AdaptyUI
AdaptyUI.activate()
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:
Level | Description |
---|---|
AdaptyLogLevel.NONE | Nothing will be logged. Default value |
AdaptyLogLevel.ERROR | Only errors will be logged |
AdaptyLogLevel.WARN | Errors and messages from the SDK that do not cause critical errors, but are worth paying attention to will be logged. |
AdaptyLogLevel.INFO | Errors, warnings, and various information messages will be logged. |
AdaptyLogLevel.VERBOSE | Any 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.
- Kotlin
- Java
Adapty.logLevel = AdaptyLogLevel.VERBOSE
//recommended for development and the first production release
Adapty.setLogLevel(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:
- Kotlin
- Java
Adapty.setLogHandler { level, message ->
//handle the log
}
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.
- Kotlin
- Java
AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.withIpAddressCollectionDisabled(true)
.build()
new 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.
- Kotlin
- Java
AdaptyConfig.Builder("PUBLIC_SDK_KEY")
.withAdIdCollectionDisabled(true)
.build()
new 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).
- Kotlin
- Java
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)
import com.adapty.ui.AdaptyUI;
import com.adapty.ui.AdaptyUI.MediaCacheConfiguration;
MediaCacheConfiguration cacheConfig = new MediaCacheConfiguration.Builder()
.overrideDiskStorageSizeLimit(200L * 1024 * 1024) // 200 MB
.overrideDiskCacheValidityTime(TimeInterval.days(3))
.build();
AdaptyUI.configureMediaCache(cacheConfig);
Parameters:
Parameter | Presence | Description |
---|---|---|
diskStorageSizeLimit | optional | Total cache size on disk in bytes. Default is 100 MB. |
diskCacheValidityTime | optional | How long cached files are considered valid. Default is 7 days. |
You can clear the media cache at runtime using AdaptyUI.clearMediaCache(strategy)
, where strategy
can be CLEAR_ALL
or CLEAR_EXPIRED_ONLY
.