Android SDKをダウンロードしインストールする方法を説明しています。


これらの手順に従うためには、Android Studioが必要です。

Android SDKのインストール

Gradle、または手動のいずれかの方法でAndroid SDKをインストールしてください。

Install using Gradle


In the Project build.gradle file, declare the mavenCentral repository:

// ...
repositories {
/// ...

In the application build.gradle file, add the latest Android SDK package:

dependencies {
    // Get the latest version from
    implementation 'com.appsflyer:af-android-sdk:<<HERE_LATEST_VERSION>>'
    // For example
    // implementation 'com.appsflyer:af-android-sdk:6.12.1>> 

Manual install

  1. Android Studioにて、フォルダの構成を Android から Projectに切り替えてください:
  2. 最新のAndroid SDKをダウンロードし、app > libsの下にあるAndroidプロジェクトに貼り付けてください。
  3. 貼り付けた jar を右クリックし、Add As Libraryを選択してください。プロンプトが表示されたら、Refatorをクリックしてください。




Add the following permissions to AndroidManifest.xml in the manifest section:

<manifest xmlns:android=""

      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />



The AD_ID permission

In early 2022, Google announced a change to the behavior of Google Play Services and fetching of the Android Advertising ID. According to the announcement, apps targeting Android 13 (API 33) and above must declare a Google Play services normal permission in their AndroidManifest.xml file in order to get access to the device’s Advertising ID.

Starting V6.8.0, the SDK adds the AD_ID permission automatically.



  • アプリがファミリー向けデザインプログラムに参加している場合:
    • If using SDK V6.8.0 and above, you should Revoke the AD_ID permission.
    • If using SDK older than V6.8.0, don't add this permission to your app.
  • APIレベル32(Android 12L)以下を対象とするアプリの場合、このパーミッションは必要ではありません。

Apps that use SDK versions older than V6.8.0 and target Android 13 (API 33) and above must manually include the permission in their AndroidManifest.xml to have access to the Advertising ID:

<uses-permission android:name="" />


Googleのポリシーによると、子供をターゲットにしたアプリは広告 ID を伝送してはなりません。

When using SDK V6.8.0 and above, children apps targeting Android 13 (API 33) and above must prevent the permission from getting merged into their app by adding a revoke declaration to their Manifest:

<uses-permission android:name=""

詳細は、Google Play Servicesのドキュメントを参照して下し亜。


If you are using ProGuard and you encounter a warning regarding our AFKeystoreWrapper class, then add the following code to your file:

AppsFlyer SDK ProGuard ルール

-keep class com.appsflyer.** { *; }
-keep class kotlin.jvm.internal.** { *; }


AppsFlyer SDKは、いくつかのストアリファラーライブラリをサポートしています。ストアリファラーを使用すると、アトリビューションの精度が向上します。


Google Play Install Referrer

Add the following dependency to your build.gradle:

dependencies {
    // ...
    implementation ""

Google Play Install Referrer ProGuard ルール

-keep public class** { *; }

Meta Install Referrer

Meta install referrer allows AppsFlyer to receive ad campaign metadata from a device’s local storage.

Meta Install Referrer basic flow

The basic flow of the Meta install referrer mechanism is as follows:

  1. Once the SDK initializes, it uses the app's Facebook App ID to make a request to the Meta Content Provider API, retrieving the stored metadata from the Facebook app.
  2. AppsFlyer SDK sends the install event, along with the attribution data, to the AppsFlyer servers.


To support the Meta install referrer, the following is required:

  • SDK: Integrate with Android SDK version 6.12.6 or higher.
  • Facebook App Version: Users must have version 428.x.x or above installed on their device.
  • Instagram App Version: Users must have version 296.x.x or above installed on their device.

Configure Meta Install Referrer Support

To enable Meta install referrer support make the Facebook App ID available to the SDK by adding it to the AndroidManifest.xml. This can be done either when integrating the Facebook SDK with the app or when integrating the AppsFlyer SDK with the app.

With Facebook SDK integrated

Refer to Facebook’s official guide to learn how to add the Facebook App ID to AndroidManifest.xml. The SDK will read the Facebook App ID from the meta-data タグの上部に貼り付けてください。

Without Facebook SDK integration

Include the following tag in AndroidManifest.xml 

<meta-data android:name="com.appsflyer.FacebookApplicationId" android:value="@string/facebook_application_id" />

Include in your strings.xml file:

<string name="facebook_application_id" translatable="false"><YOUR_FACEBOOK_APP_ID></string>

Huawei Install Referrer

Huawei Referrer is supported in SDK v6.14.0 and above.
Due to changes in the Huawei AppGallery store, previous versions of the AppsFlyer SDK are not able to fetch the referrer from the store.

Add the following repository to your Project's build.gradle:

repositories {
    maven { url '' }

Add the following dependency in the app's build.gradle:

dependencies {
    // ...
    implementation 'com.huawei.hms:componentverifysdk:'

Xiaomi GetApps store referrer

Add the following dependency to your build.gradle:

dependencies {
  // ...
  implementation "com.miui.referrer:homereferrer:"

Xiaomi GetAppsストアリファラーProGuardルール

-keep public class com.miui.referrer.** {*;}



Samsung store referrer is supported out-of-the-box starting SDK V6.1.1 and does not require any additional integration.


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 application@fullBackupContent 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:

    ...//your custom rules
    <exclude domain="sharedpref" path="appsflyer-data"/>

Missing resource files

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.

Android StudioでAPKを開き、必要なファイルが揃っていることを確認してください。


Boot Complete

If your app listens for LOCKED_BOOT_COMPLETED, make sure that all interactions with the SDK are initiated from the launcher activity. This precaution prevents the SDK from crashing when attempting to access SharedPreferences on a device that is still locked.