Search Unity

ARCore 1.7.0 + Unity-ARKit-Plugin = Gradle build error

Discussion in 'AR/VR (XR) Discussion' started by andersemil, Mar 22, 2019.

  1. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    112
    We're doing a cross-platform mobile AR game and decided to use ARCore for world tracking on Android and ARKit world tracking on iOS.

    We first integrated Google ARCore 1.7.0 SDK and it worked perfectly on Android.
    Then we integrated Unity-ARKit-Plugin and after a bit of fiddling it also started working on iOS.

    But now, with both integrations, we can no longer build for Android. Apparently there's a conflicting dependency, but it doesn't make much sense:

    AGPBI: {"kind":"error","text":"Program type already present: a.a.b","sources":[{}],"tool":"D8"}
    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForRelease'.
    > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

    ...

    Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
    Program type already present: a.a.b


    The link mentioned in the output talks about two libraries depending on the same library, but the package name "a.a.b" seems corrupt?

    Any ideas at all very welcome. Like I said, gradle build worked perfectly before integrating Unity-ARKit-Plugin.

    UPDATE: This turned out to have nothing to do with Unity-ARKit-Plugin after all. Somehow the core-1.7.0.aar library had snuck its way into our Assets/Plugins/Android folder, apparently conflicting with an external gradle dependency. Deleting the file fixed the problem. But thanks to gradle for the incredibly unhelpful error message.
     
    Last edited: Mar 22, 2019