Facebook SDK 연동 후 다음과 같은 오류가 계속 발생하면서 빌드 Failed가 떴다.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class android.support.customtabs.ICustomTabsCallback found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.ICustomTabsCallback$Stub found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.ICustomTabsCallback$Stub$Proxy found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.ICustomTabsService found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.ICustomTabsService$Stub found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.ICustomTabsService$Stub$Proxy found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.IPostMessageService found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.IPostMessageService$Stub found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
Duplicate class android.support.customtabs.IPostMessageService$Stub$Proxy found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:25.3.1)
....
해결방법은 의외로 간단하다.
(1) Unity > Edit > Project Setting > Player
아래 이미지에서 Customg Gradle Properties Template 체크
(2) Unity 프로젝트 폴더 하위 Assets > Plugins > Android > gradleTemplate.properties 파일 오픈
오픈하면 이런식으로 되어 있음
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**Morg.gradle.parallel=true**ADDITIONAL_PROPERTIES**
**ADDITIONAL_PROPERTIES** 위에 아래 두줄 추가
android.useAndroidX=trueandroid.enableJetifier=true
최종 gradleTemplate.properties 파일은 아래와 같이 된다.
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**Morg.gradle.parallel=trueandroid.useAndroidX=trueandroid.enableJetifier=true**ADDITIONAL_PROPERTIES**
이렇게 한 후 빌드하면 오류가 사라지고 빌드에 성공한다.