SDK 인스톨

안드로이드 SDK를 다운로드하여 설치하는 방법을 배웁니다.

시작하기 전에

이 가이드에 따르려면 Android Studio가 필요합니다.

안드로이드 SDK 설치하기

Gradle을 사용하거나 수동으로 안드로이드 SDK를 설치합니다.

Install using Gradle

필수

1단계: 저장소 선언하기
In the Project build.gradle file, declare the mavenCentral repository:

// ...
repositories {
   mavenCentral()
}
/// ...

2단계: 의존성 추가
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:<<HERE_LATEST_VERSION>>'
    // For example
    // implementation 'com.appsflyer:af-android-sdk:6.12.1>> 
}

Manual install

  1. Android Studio에서 폴더 구조를 안드로이드 에서 프로젝트로 전환합니다.
  2. 최신 안드로이드 SDK를 다운로드하고 앱 > 라이브러리 아래에 있는 안드로이드 프로젝트에 붙여넣습니다.
  3. 붙여넣은 jar을 마우스 오른쪽 버튼으로 클릭하고 라이브러리로 추가를 선택합니다. 프롬프트가 표시되면 Refactor를 클릭합니다.

    git에 커밋하라는 메시지가 표시되면 확인을 클릭합니다.

    .

설정이 필요한 권한

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package=YOUR_PACKAGE_NAME>

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

      ...

</manifest>

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(안드로이드 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="com.google.android.gms.permission.AD_ID" />

AD_ID 권한 취소

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="com.google.android.gms.permission.AD_ID"
 tools:node="remove"/>

자세한 내용은 Google Play 서비스 설명서를 참조하십시오.

ProGuard 경고

선택 가능
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:

앱스플라이어 SDK ProGuard 규칙

-keep class com.appsflyer.** { *; }

스토어 리퍼러 라이브러리 추가

앱스플라이어 SDK는 여러 스토어 리퍼러 라이브러리를 지원합니다. 스토어 리퍼러를 사용하면 어트리뷰션 정확도가 향상됩니다.

리퍼러 종속성을 추가하기만 하면 나머지는 SDK에서 처리합니다.

Google Play Install Referrer

Add the following dependency to your build.gradle:

dependencies {
    // ...
    implementation "com.android.installreferrer:installreferrer:2.2"
}

구글 플레이 인스톨 리퍼러 ProGuard 규칙

-keep public class com.android.installreferrer.** { *; }

Xiaomi GetApps store referrer

V6.9.0
Add the following dependency to your build.gradle:

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

Xiaomi GetApps 스토어 리퍼러 ProGuard 규칙

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

📘

참고

Huawei and Samsung store referrers are supported out-of-the-box starting SDK V6.1.1 and do 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:

<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.

안드로이드 스튜디오에서 APK를 열어 필요한 파일이 있는지 확인하십시오.

해당 파일이 누락되어 있다면, SDK가 앱스플라이어 서버에 네트워크 요청을 할 수 없어서 담당 고객 성공 매니저나 지원팀에 연락해야 합니다.