title: Unity3d Admob integration breaks Android Build: "D8: Program type already present: android.support.customtabs.ICustomTabsCallback"
body: <p>I am developing an Android Game and for a week now, I have tried my best to implement AdMob with Mediation. It works fine in the Editor, but when I build, it throws the error mentioned below. I did try to implement multiple other plugins and they built successfully, but crashed on launch (also tried with just their sample app implementations in new projects).</p>
  
  <p>After a lot of digging around, I have a hypothesis that Facebook needs some aars that Admob need, but cannot use the latest version of it (I have tried latest FB SDK versions to no avail as well). Here are some things I noticed:</p>
  
  <ol>
  <li><p>Notice that CustomTabs is present here. I tried deleting these classes but then build failed with another error</p>
  
  <blockquote>
    <p>Some conflicting dependencies were found.
    The following dependency versions were modified:
    com.android.support:appcompat-v7:25.3.1 --> com.android.support:appcompat-v7:27.0.2@aar
    com.android.support:cardview-v7:25.3.1 --> com.android.support:cardview-v7:27.0.2@aar
    com.android.support:customtabs:25.3.1 --> com.android.support:customtabs:27.0.2@aar
    com.android.support:support-v4:25.3.1 --> com.android.support:support-v4:27.0.2@aar</p>
  </blockquote></li>
  <li><p>This is the AndroidResolverDependencies.xml file in ProjectSettings Dir.</p>
  
  <p>
    
      com.android.support:appcompat-v7:25.3.1
      com.android.support:cardview-v7:25.3.1
      com.android.support:customtabs:25.3.1
      com.android.support:support-v4:25.3.1
      com.facebook.android:facebook-core:[5,6)
      com.facebook.android:facebook-login:[5,6)
      com.facebook.android:facebook-share:[5,6)
      com.google.ads.mediation:unity:3.1.0.0
      com.google.android.gms:play-services-ads:18.0.0
      com.parse.bolts:bolts-android:1.4.0
      com.unity3d.ads:unity-ads:3.1.0
    
  
          Assets/Plugins/Android/android.arch.core.common-1.0.0.jar
          Assets/Plugins/Android/android.arch.lifecycle.common-1.0.3.jar
          Assets/Plugins/Android/android.arch.lifecycle.runtime-1.0.3.aar
          Assets/Plugins/Android/androidx.annotation.annotation-1.0.0.jar
          Assets/Plugins/Android/androidx.arch.core.core-common-2.0.0.jar
          Assets/Plugins/Android/androidx.arch.core.core-runtime-2.0.0.aar 
  Assets/Plugins/Android/androidx.asynclayoutinflater.asynclayoutinflater-1.0.0.aar
      Assets/Plugins/Android/androidx.browser.browser-1.0.0.aar
      Assets/Plugins/Android/androidx.collection.collection-1.0.0.jar
      Assets/Plugins/Android/androidx.coordinatorlayout.coordinatorlayout-1.0.0.aar
      Assets/Plugins/Android/androidx.core.core-1.0.0.aar
      Assets/Plugins/Android/androidx.cursoradapter.cursoradapter-1.0.0.aar
      Assets/Plugins/Android/androidx.customview.customview-1.0.0.aar
      Assets/Plugins/Android/androidx.documentfile.documentfile-1.0.0.aar
          Assets/Plugins/Android/androidx.drawerlayout.drawerlayout-1.0.0.aar
          Assets/Plugins/Android/androidx.fragment.fragment-1.0.0.aar
          Assets/Plugins/Android/androidx.interpolator.interpolator-1.0.0.aar
          Assets/Plugins/Android/androidx.legacy.legacy-support-core-ui-1.0.0.aar
          Assets/Plugins/Android/androidx.legacy.legacy-support-core-utils-1.0.0.aar
          Assets/Plugins/Android/androidx.lifecycle.lifecycle-common-2.0.0.jar
          Assets/Plugins/Android/androidx.lifecycle.lifecycle-livedata-2.0.0.aar
          Assets/Plugins/Android/androidx.lifecycle.lifecycle-livedata-core-2.0.0.aar
          Assets/Plugins/Android/androidx.lifecycle.lifecycle-runtime-2.0.0.aar
          Assets/Plugins/Android/androidx.lifecycle.lifecycle-viewmodel-2.0.0.aar
          Assets/Plugins/Android/androidx.loader.loader-1.0.0.aar
  Assets/Plugins/Android/androidx.localbroadcastmanager.localbroadcastmanager-1.0.0.aar
      Assets/Plugins/Android/androidx.print.print-1.0.0.aar
      Assets/Plugins/Android/androidx.slidingpanelayout.slidingpanelayout-1.0.0.aar
      Assets/Plugins/Android/androidx.swiperefreshlayout.swiperefreshlayout-1.0.0.aar
      Assets/Plugins/Android/androidx.versionedparcelable.versionedparcelable-1.0.0.aar
      Assets/Plugins/Android/androidx.viewpager.viewpager-1.0.0.aar
      Assets/Plugins/Android/com.android.support.animated-vector-drawable-27.0.2.aar
  Assets/Plugins/Android/com.android.support.appcompat-v7-27.0.2.aar
      Assets/Plugins/Android/com.android.support.cardview-v7-27.0.2.aar
      Assets/Plugins/Android/com.android.support.customtabs-27.0.2.aar
      Assets/Plugins/Android/com.android.support.support-annotations-27.0.2.jar
      Assets/Plugins/Android/com.android.support.support-compat-27.0.2.aar
      Assets/Plugins/Android/com.android.support.support-core-ui-27.0.2.aar
      Assets/Plugins/Android/com.android.support.support-core-utils-27.0.2.aar
      Assets/Plugins/Android/com.android.support.support-fragment-27.0.2.aar
      Assets/Plugins/Android/com.android.support.support-media-compat-27.0.2.aar
        Assets/Plugins/Android/com.android.support.support-v4-27.0.2.aar
          Assets/Plugins/Android/com.android.support.support-vector-drawable-27.0.2.aar
          Assets/Plugins/Android/com.facebook.android.facebook-common-5.1.0.aar
          Assets/Plugins/Android/com.facebook.android.facebook-core-5.1.0.aar
          Assets/Plugins/Android/com.facebook.android.facebook-login-5.1.0.aar
          Assets/Plugins/Android/com.facebook.android.facebook-share-5.1.0.aar
          Assets/Plugins/Android/com.google.ads.mediation.unity-3.1.0.0.aar
          Assets/Plugins/Android/com.google.android.gms.play-services-ads-18.0.0.aar
          Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-18.0.0.aar
        Assets/Plugins/Android/com.google.android.gms.play-services-ads-identifier-17.0.0.aar
              Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-18.0.0.aar
              Assets/Plugins/Android/com.google.android.gms.play-services-basement-17.0.0.aar
              Assets/Plugins/Android/com.google.android.gms.play-services-gass-18.0.0.aar
              Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-17.0.0.aar
              Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-17.0.0.aar
              Assets/Plugins/Android/com.google.zxing.core-3.3.3.jar
              Assets/Plugins/Android/com.parse.bolts.bolts-android-1.4.0.jar
              Assets/Plugins/Android/com.parse.bolts.bolts-applinks-1.4.0.jar
              Assets/Plugins/Android/com.parse.bolts.bolts-tasks-1.4.0.jar
              Assets/Plugins/Android/com.unity3d.ads.unity-ads-3.1.0.aar
            </p>
  
  <pre><code>  &lt;settings&gt;
      &lt;setting name="androidAbis" value="armeabi-v7a,x86" /&gt;
      &lt;setting name="bundleId" value="com.pratyaksh.cosmicballs" /&gt;
      &lt;setting name="explodeAars" value="True" /&gt;
      &lt;setting name="gradleBuildEnabled" value="True" /&gt;
      &lt;setting name="gradleTemplateEnabled" value="False" /&gt;
      &lt;setting name="installAndroidPackages" value="True" /&gt;
      &lt;setting name="packageDir" value="Assets\Plugins\Android" /&gt;
      &lt;setting name="patchAndroidManifest" value="True" /&gt;
      &lt;setting name="patchMainTemplateGradle" value="True" /&gt;
      &lt;setting name="projectExportEnabled" value="False" /&gt;
      &lt;setting name="useJetifier" value="False" /&gt;
    &lt;/settings&gt;
  &lt;/dependencies&gt;
  </code></pre></li>
  <li><p>Smaller Portions from error log</p>
  
  <blockquote>
    <p>CommandInvokationFailure: Gradle build failed. 
    E:\UnityEditor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "E:\UnityEditor\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    stderr[
    D8: Program type already present: android.support.customtabs.ICustomTabsCallback
    FAILURE: Build failed with an exception.</p>
    
    <ul>
    <li>What went wrong:
    Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForRelease'.
    com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: </li>
    </ul>
  </blockquote></li>
  </ol>
  
  <p>.
  .
  //SHORTENED FOR STACKOVERFLOW
  .
  .
  .</p>
  
  <blockquote>
    <p>:transformClassesWithDexBuilderForRelease
    C:\Users\TehBlindNutSack.gradle\caches\transforms-1\files-1.1\facebook-android-wrapper-7.17.0.aar\4bb1132b85935d425bf3b80edd9162a8\jars\classes.jar: D8: Interface <code>com.facebook.applinks.AppLinkData$CompletionHandler</code> not found. It's needed to make sure desugaring of <code>com.facebook.unity.FB$2</code> is correct. Desugaring will assume that this interface has no default method.<code>
    C:\Users\TehBlindNutSack\.gradle\caches\transforms-1\files-1.1\facebook-android-wrapper-7.17.0.aar\4bb1132b85935d425bf3b80edd9162a8\jars\classes.jar: D8: Type</code>com.facebook.applinks.AppLinkData<code>was not found, it is required for default or static interface methods desugaring of</code>void com.facebook.unity.FB.FetchDeferredAppLinkData(java.lang.String)`
    :transformDexArchiveWithExternalLibsDexMergerForRelease FAILED</p>
  </blockquote>
  
  <p>Please, if someone could help me get it right, it would mean a world to me.
  Sorry for bad formatting.</p>
  
  <p>Edit: Steps to reproduce: 
  1. Create a new Unity(2019.1.0f2) Project with android build support
  2. Add FB SDK
  3. add GoogleMobileAds SDK
  4. Build</p>