# 프로젝트 설정

### 1 : SDK 연동을 위한 준비

* Android Studio 환경
* Android 4.1 (API Version 16) 이상
* Android Support Library

### 2 : Gradle 연동

#### 1. 라이브러리 설정

**Android Studio (jitpack을 통한 설정)**

* AdPie SDK는 `jitpack`을 통해 AAR 파일을 사용할 수 있으며, `build.gradle` 파일에 아래의 내용을 추가합니다.
* Support Library 를 사용하기 위해 `Google Maven Repository` 를 마찬가지로 추가합니다.

```
repositories {
    google()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.adxcorp:adpie-android-sdk:1.16.5'
}
```

### 3 : 수동 연동 (Jar 파일)

<https://github.com/gomfactory/AdPie-Android-SDK/tree/master/JAR> 에서 Jar 파일을 받아서 수동으로 연동합니다.

#### 1. 권한 추가

* `AndroidManifest.xml` 에 필수 권한을 추가합니다.

```xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
```

#### 2. 전면배너와 웹뷰 랜딩을 위한 액티비티 추가

* `AndroidManifest.xml`에서 `<application>` 태그 안에 activity를 추가합니다.

```xml
<activity android:name="com.gomfactory.adpie.sdk.InAppBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:launchMode="singleTop"
    android:windowSoftInputMode="adjustResize"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

<activity android:name="com.gomfactory.adpie.sdk.InterstitialActivity"
      android:configChanges="keyboardHidden|orientation|screenSize"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

<activity android:name="com.gomfactory.adpie.sdk.videoads.VideoFullScreenActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
```

#### 3. Google Play Service 연동

광고 ID를 사용할 수 있도록 하기 위해 [Google Play Services SDK](https://developers.google.com/android/guides/setup#Setup/)가 포함되어야 합니다.

* `build.gradle` 파일에 아래와 같이 추가를 합니다.

```
dependencies {
    implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
}
```

* `AndroidManifest.xml`에 `<application>` 태그 하위에 아래와 같이 추가를 합니다.

```xml
<meta-data android:name="com.google.android.gms.version"
                    android:value="@integer/google_play_services_version" />
```

#### 4. 프로가드 설정

```
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

-keep class com.google.android.gms.ads.** { *; }
-dontwarn com.google.android.gms.ads.**

-keep class com.gomfactory.** { *; }
-dontwarn com.gomfactory.**
-dontwarn com.bumptech.glide.**
```

### 4 : Java 호환성

* Java 8 언어 기능을 지원을 위해 `build.gradle` 파일에 android 섹션에서 compileOptions 을 추가합니다.

```
android {
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    // For Kotlin projects
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform-business.gitbook.io/adpie/android/project-settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
