Install SDK
Learn how to download and install the Android SDK.
Before you begin
You need Android Studio to follow along with these guides.
Installing the Android SDK
Install the Android SDK using your preferred method: Via Gradle, or manually.
Install using Gradle
Step 1: Declare repositories
In the Project build.gradle
file, declare the mavenCentral
repository:
// ...
repositories {
mavenCentral()
}
/// ...
Step 2: Add dependencies
In the application build.gradle
file, add the latest Android SDK package:
dependencies {
// Get the latest version from https://mvnrepository.com/artifact/com.appsflyer/af-android-sdk
implementation 'com.appsflyer:af-android-sdk:6.3.2'
}
Manual install
- In Android Studio, switch the folder structure from Android to Project:
- Download the latest Android SDK and paste it in your Android project, under app > libs.
- Right-click the
jar
you pasted and select Add As Library. When prompted, click Refactor. If prompted to commit to git, click OK.
Setting required permissions
Add the following permissions to AndroidManifest.xml
:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Apps targeting Android 13 should add the following permission to AndroidManifest.xml
to access the Android Advertising Identifier:
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
Note
- If your app participates in the Designed for Families program, you shouldn't add this permission.
- For apps that target API level 32 (Android 12L) or older, this permission is not needed.
For more information, see Google Play Services documentation.
Adding the Google Play Install Referrer
Optional Recommended
To improve attribution accuracy, it's recommended to install the Google Play Install Referrer.
Note
You only need to add the Google Play Install Referrer dependency, the SDK takes care of the rest.
ProGuard rules
Optional
If you are using ProGuard and you encounter a warning regarding our AFKeystoreWrapper
class, then add the following code to your proguard-rules.pro
file:
-keep class com.appsflyer.** { *; }
Known issues
Backup rules
If you add android:fullBackupContent="true"
inside the tag in the AndroidManifest.xml
, you might get the following error:
Manifest merger failed : Attribute [email protected] value=(true)
To fix this error, add tools:replace="android:fullBackupContent" in the <application>
tag in the AndroidManifest.xml
file.
If you have your own backup rules specified (android:fullBackupContent="@xml/my_rules"
), in addition to the instructions above, please merge them with AppsFlyer rules manually by adding the following rule:
<full-backup-content>
...//your custom rules
<exclude domain="sharedpref" path="appsflyer-data"/>
</full-backup-content>
Missing resource files
SDK V5
If you are using Android SDK V5 and above, make sure that in the APK file, in addition to the classes.dex
and resources files, you also have a com > appsflyer > internal folder with files a-
and b-
inside.
Note: Before SDK 5.3.0, file names are a.
and b.
Check that you have the required files by opening your APK in Android Studio:


If those files are missing, the SDK can't make network requests to our server, and you need to contact your CSM or support.
Updated 23 days ago