> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deeplink.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Android setup

> Configure Android app links and install referrer for DeepLink

To attribute installs and open your app from DeepLink links on Android, you need **App Links** (for opening the app) and **Install Referrer** (for attributing the install).

## 1. Install Referrer (for install attribution)

Add the Play Install Referrer dependency in `android/app/build.gradle`:

```groovy theme={null}
dependencies {
    implementation 'com.android.installreferrer:installreferrer:2.2'
}
```

The DeepLink SDK uses this to read the referrer when the user installed the app from a link (e.g. from your DeepLink domain).

## 2. App Links (for opening the app from links)

So that `https://your-subdomain.deeplink-domain.com/your-path` opens your app:

1. **Intent filters** — In `android/app/src/main/AndroidManifest.xml`, add an intent filter for your DeepLink host and path. Replace the host with the subdomain you use in the DeepLink dashboard (e.g. your app’s subdomain).

```xml theme={null}
<activity android:name=".MainActivity">
  <!-- ... existing config ... -->
  <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
      android:scheme="https"
      android:host="your-subdomain.deeplink-domain.com"
      android:pathPrefix="/"
      android:pathPattern="/.*" />
  </intent-filter>
</activity>
```

> **Note:** DeepLink automatically handles the required Digital Asset Links (`/.well-known/assetlinks.json`) for both managed and custom domains once you configure your app (package name and SHA-256 fingerprint) in the dashboard. You don’t need to host or manage this file yourself.

## 3. ProGuard / R8 (if you use shrinking)

If you enable code shrinking, keep the Install Referrer and any DeepLink SDK classes from being stripped. For example:

```proguard theme={null}
-keep class com.android.installreferrer.** { *; }
# Add any rules provided by the deeplink_flutter_sdk package.
```

Check the `deeplink_flutter_sdk` package docs or example for the exact rules.

## 4. Initialize the SDK

In your Flutter app, call the SDK `init` with your API key (and optional base URL) as shown in [Quickstart](/quickstart). On first launch, the SDK will:

* Read the **Play Install Referrer** (when present) or use a stored `linkId`.
* Report the install to the Track Install API so clicks from your DeepLink domain can be attributed.

## Troubleshooting

* **App doesn’t open from link** — Confirm the host in the intent filter matches the link domain, and that `assetlinks.json` is reachable and correct.
* **Install not attributed** — Ensure the Install Referrer dependency is added and the user actually installed from a link that points to your DeepLink domain (and that the referrer is set by the store/link).

<Card title="iOS setup" icon="apple-whole" href="/sdk/ios-setup">
  Configure Associated Domains for iOS.
</Card>
