Android Native SDK
The PulpoAR Android SDK brings the virtual try-on into your Android app natively, with no WebView. It shows your project's catalog and Studio theme, and runs the camera and makeup natively.
The Android SDK is currently in pre-release. Pin an exact version and test your release build on a device before shipping.
- The SDK is proprietary and needs an agreement with PulpoAR.
- You need your project slug from PulpoAR Studio. The SDK uses it to load your catalog and theme.
- Runnable example apps are in pulpoar-plugin-examples.
Choose an artifact
| Artifact | Use it when |
|---|---|
com.pulpoar:tryon-ui (recommended) | You want the complete try-on (live camera, photo, models, products, looks, before/after), styled with your Studio theme. One composable, no try-on code. Includes the Kit and the engine. |
com.pulpoar:tryon-kit | You design your own screens. The Kit gives you the camera view, catalog and makeup, without UI. |
Requirements
- Android 7.0 (API 24) or later (
minSdk = 24) - Jetpack Compose with the Kotlin Compose compiler plugin (
org.jetbrains.kotlin.plugin.compose) andbuildFeatures { compose = true } - Built and tested with compileSdk 36, AGP 8.13 and Java 17
1. Add the PulpoAR repository
In settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://assets.pulpoar.com/vision/pulpo-sdk/android/maven")
content { includeGroup("com.pulpoar") }
}
}
}
2. Add the dependency
In your app module's build.gradle.kts:
dependencies {
implementation("com.pulpoar:tryon-ui:<version>")
}
Always pin an exact version. The repository has no "latest" index. Find the newest version on the releases page.
3. Camera permission
Nothing to add. The SDK merges the INTERNET, ACCESS_NETWORK_STATE and CAMERA permissions into your manifest, and the try-on asks for the camera when it needs it. Photo upload uses the system photo picker, which needs no permission.
4. Configure once
In your Application class (registered in AndroidManifest.xml as android:name):
import com.pulpoar.tryon.PulpoAnalyticsConsent
import com.pulpoar.tryon.PulpoTryOn
import com.pulpoar.tryon.PulpoTryOnConfiguration
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
PulpoTryOn.configure(this, PulpoTryOnConfiguration(analyticsConsent = PulpoAnalyticsConsent.PENDING))
}
}
Nothing is reported while consent is PENDING. When the user answers your consent prompt, pass their answer:
PulpoTryOn.analyticsConsent = if (userAccepted) PulpoAnalyticsConsent.GRANTED else PulpoAnalyticsConsent.DENIED
Never pass GRANTED without the user's consent.
5. Show the try-on
Anywhere in your Compose UI:
import com.pulpoar.tryon.ui.PulpoTryOnView
PulpoTryOnView(projectSlug = "your-project", modifier = Modifier.fillMaxSize())
Views-based apps
Host the composable in a ComposeView:
findViewById<ComposeView>(R.id.tryOn).setContent {
PulpoTryOnView(
projectSlug = "your-project",
configuration = PulpoTryOnUIConfiguration(onClose = { finish() }),
)
}
6. Connect it to your app
All configuration options are optional:
PulpoTryOnView(
projectSlug = "your-project",
modifier = Modifier.fillMaxSize(),
configuration = PulpoTryOnUIConfiguration(
onAddToCart = { variants -> cart.add(variants) }, // without it, Add to Cart opens the product's web page
onGoToProduct = { variant -> openProductPage(variant) }, // the Details button
onClose = { isTryOnOpen = false }, // the close button; dismiss the try-on here
customizeTheme = { theme ->
theme.catalog.withGoToProduct = false // override anything in your Studio theme
},
),
)
| Option | Description |
|---|---|
onAddToCart | Called with the selected variants when Add to Cart is tapped. Without it, Add to Cart opens the product's web page. |
onGoToProduct | Called when the Details button is tapped. |
onClose | Called when the close button is tapped. Dismiss the try-on here. |
customizeTheme | Changes any value of your Studio theme in code. |
initialSelection | Opens on a product (PulpoTryOnInitialSelection.Product("product-slug")), shades (.Variants(listOf("variant-slug"))) or a look (.Look("look-id")). |
locale | Forces a language: en, tr, pt, it, fr or ru. Otherwise it follows the theme and the device. |
Recommended view size
The same layout rules as iOS apply:
- Phone layout: when the view is taller than it is wide. The camera is on top and the catalog at the bottom.
- Wide layout: when the view is wider than it is tall, or at least 700 dp wide (tablets). The camera is on the left and the catalog on the right.
- Show it full screen or in a full-height bottom sheet. Keep the image area at least 520 dp tall, or the controls switch to a compact version.
Building your own UI with the Kit
Use com.pulpoar:tryon-kit instead of tryon-ui. A session owns the camera, catalog and makeup. A camera view shows the result.
// implementation("com.pulpoar:tryon-kit:<version>")
// Ask for the CAMERA permission yourself before starting in camera mode.
private val session = PulpoTryOnSession("your-project")
lifecycleScope.launch {
try {
session.start(PulpoTryOnSession.Mode.Camera(), lifecycleOwner = this@TryOnActivity)
val catalog = session.catalog.value ?: return@launch
session.apply(listOf(catalog.variants.first()))
} catch (error: PulpoException) {
// CameraPermissionDenied, Network, UnsupportedDevice…
}
}
// Show it with PulpoCameraView(context).apply { bind(session) }
// and call session.dispose() when the screen is destroyed.
Good to know
- R8 / minified builds: the SDK packages its own R8 rules, so you don't add any. Test your minified release build on a device before shipping.
- One try-on at a time: the engine is shared, so only the visible try-on uses it.
- Hidden and shown again: when the try-on is in a tab you leave, it keeps its state and comes back where it was.
Resources
- Kotlin Try-On UI example: a small Compose shop that opens the try-on full screen, as a pushed screen and in a tab, with a working Add to Cart.
- Kotlin Native SDK example
- pulpoar-android-sdk: releases, changelog and checksums.