리마스터 안드로이드 SDK v2로 업데이트하기
팔로우1. 시작
디파이너리(애드브릭스) 1.x.x.x 버전에서 2.x.x.x 버전으로 업데이트를 하기 위해 필요한 내용을 안내합니다.
2. Android Native
2.1. build.gradle (Project: ProjectName) 설정
프로젝트 레벨의 build.gradle 내용에 아래와 항목을 추가합니다.
이미 모든 항목이 있는 경우에는 이 단계를 뛰어넘어도 좋습니다.
allprojects {
repositories {
google()
mavenCentral()
}
}
2.2. build.gradle (Module:app) 설정
모듈 레밸의 build.gradle 내용에 아래와 같이 Dependencies를 추가합니다.
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.android.installreferrer:installreferrer:2.2'
//SDK는 항상 최신 버전을 유지해주세요.
implementation 'io.dfinery:android-sdk:2.5.1.8'
}
//jetifier 사용이 불가능한 경우
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.android.installreferrer:installreferrer:2.2'
//디파이너리 SDK는 항상 최신 버전을 유지해주세요.
implementation('io.dfinery:android-sdk:2.5.1.8'){
exclude group: 'com.android.support'
}
}
2.3. Sync gradle
안드로이드 스튜디오에서 Sync 를 실행하여 v2 SDK를 설치합니다.
2.4. 설치 확인
설치가 완료된 후에는 프로젝트뷰의 External Libraries 목록에서 아래와 같이 v2 SDK를 확인하실 수 있습니다.
2.5. 참조 클래스 변경
v2 SDK에서는 참조 클래스가 변경되었습니다. 따라서 프로젝트에서 임포트를 하는 클래스 명을 아래와 같이 변경합니다.
import com.igaworks.v2.core.AdBrixRm;
2.6. API 사용 코드 변경
v2 SDK는 위 작업을 통해서 기존 API를 그대로 사용하실 수 있습니다.
3. React Native
React Native 사용시 아래와 같이 SDK 를 업데이트 합니다.
3.1 SDK 업데이트
npm 을 통해 React Native 용 AdBrixRM SDK 를 최신 버전으로 업데이트 할 수 있습니다. (현재 최신 버전 : 2.3.0)
npm update react-native-adbrix-remaster --save
3.2 Android 프로젝트 수정
1. 아래와 같이 allprojects 항목에 mavenCentral() 을 [build.gradle (Project: ProjectName)] 에 추가합니다.
allprojects {
repositories {
google()
mavenCentral()
}
}
2. 다음 dependencies 를 [app:build.gradle] 에 추가합니다.
dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.android.installreferrer:installreferrer:2.2'
implementation 'io.dfinery:android-sdk:2.5.1.8'
}
3. [AndroidManifest.xml > manifest] 에 다음과 같이 설정합니다.
<manifest>
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- OPTIONAL -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
...
</manifest>
4. SDK 구동 및 분석이 원할하게 진행될 수 있도록 app / proguard-rule.pro 에 아래 코드를 추가합니다.
# Add any project specific keep options here:
-keep class com.google.android.gms.common.ConnectionResult {
int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
java.lang.String getId();
boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.** { *; }
5. 안드로이드 Application 클래스에 SDK initialize 코드를 추가합니다.
public class MyApplicationClass extends Application {
@Override
public void onCreate() {
super.onCreate();
AbxActivityHelper.initializeSdk(MyApplicationClass.this, "your_adbrix_remastered_app_key", "your_adbrix_remastered_secret_key");
}
}
4. Flutter
Flutter 를 사용하는 경우 아래와 같이 업데이트를 진행합니다.
4.1. SDK 업데이트
Flutter 프로젝트 내 pubspec.yaml 파일에 아래와 같이 추가하고 pub get 명령어로 SDK 를 다운로드 합니다.
(현재 최신 버전 : 1.4.0)
dependencies: adbrixrm_flutter: ^1.4.0
5. 문의사항
업데이트 시 문제가 발생하는 경우에는 아래의 이메일로 문의 내용을 전달해주시면 저희 지원팀에서 최대한 빠르게 연락 드리겠습니다.
이메일 : se.team@adbrixsupport.zendesk.com