- Home /
D8: Program type already present: com.facebook.unity.Constants
It was good before, but not after the Unity version Upgrade 2017.3 -> 2018.4 and changes Build Setting [Scripting Backedn] [Mono] -> [IL2CPP]
version new project succeeded. i found documents but I do not know what to do.
[DOCUMENT] Fix duplicate class errors If a class appears more than once on the runtime classpath, you get an error similar to the following: Program type already present com.example.MyClass This error typically occurs due to one of the following circumstances: A binary dependency includes a library that your app also includes as a direct dependency. For example, your app declares a direct dependency on Library A and Library B, but Library A already includes Library B in its binary. To resolve this issue, remove Library B as a direct dependency. Your app has a local binary dependency and a remote binary dependency on the same library. To resolve this issue, remove one of the binary dependencies. [DOCUMENT END]
CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2018.4.0f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.4.0f1\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: com.facebook.unity.Constants
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForRelease'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
0~95 C:\Superjelly\Temp\gradleOut\build\intermediates\transforms\dexBuilder\release\0.jar, ~ C:\Superjelly\Temp\gradleOut\build\intermediates\transforms\dexBuilder\release\95.jar Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: com.facebook.unity.Constants
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 16s ] stdout[ Observed package id 'tools' in inconsistent location 'C:\Users\juil\AppData\Local\Android\Sdk_tools' (Expected 'C:\Users\juil\AppData\Local\Android\Sdk\tools') :checkReleaseClasspath UP-TO-DATE :preBuild UP-TO-DATE :Firebase:preBuild UP-TO-DATE :Firebase:preReleaseBuild UP-TO-DATE :Firebase:checkReleaseManifest :Firebase:processReleaseManifest :GoogleMobileAdsPlugin:preBuild UP-TO-DATE :GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE :GoogleMobileAdsPlugin:checkReleaseManifest :GoogleMobileAdsPlugin:processReleaseManifest :preReleaseBuild UP-TO-DATE :Firebase:compileReleaseAidl NO-SOURCE :GoogleMobileAdsPlugin:compileReleaseAidl NO-SOURCE :compileReleaseAidl NO-SOURCE :Firebase:packageReleaseRenderscript NO-SOURCE :GoogleMobileAdsPlugin:packageReleaseRenderscript NO-SOURCE :compileReleaseRenderscript :checkReleaseManifest UP-TO-DATE :generateReleaseBuildConfig UP-TO-DATE :prepareLintJar UP-TO-DATE :mainApkListPersistenceRelease UP-TO-DATE :generateReleaseResValues UP-TO-DATE :generateReleaseResources :Firebase:compileReleaseRenderscript :Firebase:generateReleaseResValues :Firebase:generateReleaseResources :Firebase:packageReleaseResources :GoogleMobileAdsPlugin:compileReleaseRenderscript :GoogleMobileAdsPlugin:generateReleaseResValues :GoogleMobileAdsPlugin:generateReleaseResources :GoogleMobileAdsPlugin:packageReleaseResources :mergeReleaseResources :createReleaseCompatibleScreenManifests :processReleaseManifest C:\Superjelly\Temp\gradleOut\src\main\AndroidManifest.xml:24:9-31:50 Warning: activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present :splitsDiscoveryTaskRelease UP-TO-DATE :Firebase:generateReleaseRFile :GoogleMobileAdsPlugin:generateReleaseRFile :processReleaseResources :generateReleaseSources :Firebase:generateReleaseBuildConfig :Firebase:prepareLintJar UP-TO-DATE :Firebase:generateReleaseSources :Firebase:javaPreCompileRelease :Firebase:compileReleaseJavaWithJavac :Firebase:processReleaseJavaRes NO-SOURCE :Firebase:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease :GoogleMobileAdsPlugin:generateReleaseBuildConfig :GoogleMobileAdsPlugin:prepareLintJar UP-TO-DATE :GoogleMobileAdsPlugin:generateReleaseSources :GoogleMobileAdsPlugin:javaPreCompileRelease :GoogleMobileAdsPlugin:compileReleaseJavaWithJavac :GoogleMobileAdsPlugin:processReleaseJavaRes NO-SOURCE :GoogleMobileAdsPlugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease :javaPreCompileRelease UP-TO-DATE :compileReleaseJavaWithJavac UP-TO-DATE :compileReleaseNdk NO-SOURCE :compileReleaseSources UP-TO-DATE :lintVitalRelease :mergeReleaseShaders UP-TO-DATE :compileReleaseShaders UP-TO-DATE :generateReleaseAssets UP-TO-DATE :Firebase:mergeReleaseShaders :Firebase:compileReleaseShaders :Firebase:generateReleaseAssets :Firebase:packageReleaseAssets :GoogleMobileAdsPlugin:mergeReleaseShaders :GoogleMobileAdsPlugin:compileReleaseShaders :GoogleMobileAdsPlugin:generateReleaseAssets :GoogleMobileAdsPlugin:packageReleaseAssets :mergeReleaseAssets :transformClassesWithDexBuilderForRelease :transformDexArchiveWithExternalLibsDexMergerForRelease FAILED 49 actionable tasks: 35 executed, 14 up-to-date ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Answer by Zakboy- · Oct 31, 2019 at 11:33 AM
My issue was that I updated from FB SDK 7.17.2 or something to 7.18, but the package installer did not remove the previous wrapper for version 7.17. Check if you have both for some reason.
thanks, that was exactly the same scenario in my case. FB SD$$anonymous$$ did not remove the old libs.
Thank you sir! You just saved me.
I had to dig into the folders and found that it has Bolts file or something (which is duplicate with Firebase stuff too). So I searched Facebook SD$$anonymous$$ changelog (here) and found that my project used v 7.15 before I reimported with v 7.18. According to the link, v.7.18 has removed bolts framework but it was still there in my project. So I deleted that facebook folder, imported v 7.18 and I can build again.
Answer by Sohaib_techverx · Oct 29, 2019 at 05:32 PM
@starmonlim Hi,
Were you able to solve this issue? I am getting the same error expect that its "D8: Program type already present: com.facebook.unity.FBLogin" for me.
Thanks