---
id: "getting-started/installation/android"
title: "Android"
description: "What is RevenueCat?"
permalink: "/docs/getting-started/installation/android"
slug: "android"
version: "current"
original_source: "docs/getting-started/installation/android.mdx"
---

> **AI agents:** This is the Markdown version of a RevenueCat documentation page. For the complete documentation index, see [llms.txt](https://www.revenuecat.com/docs/llms.txt).

## What is RevenueCat?

RevenueCat provides a backend and a wrapper around StoreKit and Google Play Billing to make implementing in-app purchases and subscriptions easy. With our SDK, you can build and manage your app business on any platform without having to maintain IAP infrastructure. You can read more about [how RevenueCat fits into your app](https://www.revenuecat.com/blog/growth/where-does-revenuecat-fit-in-your-app/) or you can [sign up free](https://app.revenuecat.com/signup) to start building.

## Android

### Installation

Purchases for Android (Google Play and Amazon Appstore) is available on Maven and can be included via Gradle.

You can find the latest version below, and for more details, visit the [Releases page](https://github.com/RevenueCat/purchases-android/releases).

[![Release](https://img.shields.io/github/v/release/RevenueCat/purchases-android.svg?\&style=flat)](https://github.com/RevenueCat/purchases-android/releases)

**Kotlin**

```kotlin
implementation("com.revenuecat.purchases:purchases:9.23.1")
```

**Groovy**

```groovy
implementation 'com.revenuecat.purchases:purchases:9.1.0'
```

### Import Purchases

You should now be able to import `Purchases`.

**Kotlin**

```kotlin
import com.revenuecat.purchases.CustomerInfo
import com.revenuecat.purchases.Entitlement
import com.revenuecat.purchases.Offering
import com.revenuecat.purchases.Purchases
import com.revenuecat.purchases.models.Period
import com.revenuecat.purchases.models.Price
import com.revenuecat.purchases.models.StoreProduct
```

**Java**

```java
import com.revenuecat.purchases.CustomerInfo;
import com.revenuecat.purchases.Entitlement;
import com.revenuecat.purchases.Offering;
import com.revenuecat.purchases.Purchases;
import com.revenuecat.purchases.models.Period;
import com.revenuecat.purchases.models.Price;
import com.revenuecat.purchases.models.StoreProduct;
```

### Configure Proguard (Optional)

We are adding Proguard rules to the library so you don't need to do anything. If you have any issues finding classes in our SDK, try adding `-keep class com.revenuecat.purchases.** { *; }` to your Proguard configuration.

:::warning
Purchases uses AndroidX App Startup under the hood. Make sure you have not removed the `androidx.startup.InitializationProvider` completely in your manifest. If you need to remove specific initializers, such as `androidx.work.WorkManagerInitializer`, set `tools:node="merge"` on the provider, and `tools:node="remove"` on the meta-data of the initializer you want to remove.

```xml
 <provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    android:exported="false"
    tools:node="merge">
    <meta-data
        android:name="androidx.work.WorkManagerInitializer"
        android:value="androidx.startup"
        tools:node="remove" />
 </provider>
```

:::

### Set the correct launchMode

Depending on your user's payment method, they may be asked by Google Play to verify their purchase in their (banking) app. This means they will have to background your app and go to another app to verify the purchase. If your Activity's `launchMode` is set to anything other than `standard` or `singleTop`, backgrounding your app can cause the purchase to get cancelled. To avoid this, set the `launchMode` of your Activity to `standard` or `singleTop` in your `AndroidManifest.xml` file, like so:

```xml
<activity 
    android:name="com.your.Activity"
    android:launchMode="standard" />  <!-- or singleTop -->
```

You can find Android's documentation on the various `launchMode` options [here](https://developer.android.com/guide/topics/manifest/activity-element#lmode).

## Amazon

### Additional Dependencies

Add a new dependency to the `build.gradle` apart from the regular `purchases` dependency. These new dependencies have the classes needed to use Amazon IAP:

You can find the latest version below, and for more details, visit the [Releases page](https://github.com/RevenueCat/purchases-android/releases).

[![Release](https://img.shields.io/github/v/release/RevenueCat/purchases-android.svg?\&style=flat)](https://github.com/RevenueCat/purchases-android/releases)

**Kotlin**

```kotlin
implementation("com.revenuecat.purchases:purchases:9.23.1")
implementation("com.revenuecat.purchases:purchases-store-amazon:9.23.1")
```

**Groovy**

```groovy
implementation 'com.revenuecat.purchases:purchases:9.1.0'
implementation 'com.revenuecat.purchases:purchases-store-amazon:9.1.0'
```

### Add Amazon public key

Adding support for Amazon requires adding a `.pem` public key to your project. You can configure this key by following Amazon's guide [here](https://developer.amazon.com/es/docs/in-app-purchasing/integrate-appstore-sdk.html#configure_key).

Due to some limitations, RevenueCat will only validate purchases made in production or in Live App Testing and won't validate purchases made with the Amazon App Tester.

## Galaxy Store

Galaxy Store support is available in Android SDK versions `10.7.0` and above, and React Native SDK versions `10.3.0` and above. Support for other hybrid SDKs is coming soon.

### Additional Dependencies

In addition to the regular `purchases` dependency, the `purchases-store-galaxy` module must be added as well. You can find the latest version below, and for more details, visit the [Releases page](https://github.com/RevenueCat/purchases-android/releases).

[![Release](https://img.shields.io/github/v/release/RevenueCat/purchases-android.svg?\&style=flat)](https://github.com/RevenueCat/purchases-android/releases)

**Kotlin**

```kotlin
implementation("com.revenuecat.purchases:purchases:10.7.0")
implementation("com.revenuecat.purchases:purchases-store-galaxy:10.7.0")
```

**Groovy**

```groovy
implementation 'com.revenuecat.purchases:purchases:10.7.0'
implementation 'com.revenuecat.purchases:purchases-store-galaxy:10.7.0'
```

### Configuring the SDK

When you configure the RevenueCat SDK, configure it to use the Galaxy Store by using a `GalaxyConfiguration` object, like so:

```kotlin
Purchases.configure(
    // This will configure the Galaxy Store to make production purchases.
    GalaxyConfiguration.Builder(applicationContext, "galx_XXXX") // Add your RevenueCat API key here
        .build()
)
```

### SDK Usage

Once your project is set up, you can use the RevenueCat SDK with the Galaxy Store in the same manner that you would for the Play Store, including fetching offerings, displaying paywalls, and making purchases.

### Making Test Purchases

Test purchases for the Galaxy Store can only be made on a **physical Galaxy device** when signed in with a Samsung account—the Galaxy Store does not support making test purchases in emulators.

When you want to make a test purchase, pass in either `GalaxyBillingMode.TEST` or `GalaxyBillingMode.ALWAYS_FAIL` when you call `Purchases.configure()`, like so:

```kotlin
Purchases.configure(
    GalaxyConfiguration.Builder(
        applicationContext,
        "galx_XXXX", // Add your RevenueCat API key here
        GalaxyBillingMode.TEST
    )
    .build()
)
```

Using `GalaxyBillingMode.TEST` will allow you to make test purchases without creating financial transactions, while `GalaxyBillingMode.ALWAYS_FAIL` allows you to test failure scenarios. For more information on the Galaxy Store's billing modes, refer to [their documentation](https://developer.samsung.com/iap/programming-guide/iap-helper-programming.html#Set-the-IAP-operation-mode).

:::warning
Only use `GalaxyBillingMode.PRODUCTION` when submitting your app for beta or production distribution!
:::

To cancel a test subscription, go to the Galaxy Store on your phone, go to your Samsung account, and cancel the subscription. Test subscriptions will remain active until their current billing period ends.

## Next Steps

- Now that you've installed the Purchases SDK in your Android app, get started by [configuring an instance of Purchases ](https://www.revenuecat.com/docs/getting-started/quickstart#3-using-revenuecats-purchases-sdk)
