google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 402 forks source link

Conflicting Desugar Library Introduced in 1.9 #596

Open CantDisclouseMyName opened 5 years ago

CantDisclouseMyName commented 5 years ago

SPECIFIC ISSUE ENCOUNTERED

I'm having an issue with com.google.devtools.build.android.desugar.runtime.ThrowableExtension$ConcurrentWeakIdentityHashMap conflicting with the WebRTC library we're using built from source. It would be great if this can be remove the ARCore library.

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Import ARCore for Unity 1.9 into a default project
  2. Import Jar file built from WebRTC source
  3. Set Android as target and build

WORKAROUNDS (IF ANY)

Delete class files in either one of the Jar files and repackage.

ADDITIONAL COMMENTS

It looks like this was also an issue in the gvr-android-sdk repo and it got fixed in that repository. Not sure if it is related though.

Unity console build error:

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Unity\Hub\Editor\2018.4.2f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.4.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[
D8: Program type already present: com.google.devtools.build.android.desugar.runtime.ThrowableExtension$ConcurrentWeakIdentityHashMap

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\0.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\1.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\2.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\3.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\4.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\5.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\Name\source\repos\projectfolder\Temp\gradleOut\build\intermediates\transforms\dexBuilder\debug\15.jar
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: com.google.devtools.build.android.desugar.runtime.ThrowableExtension$ConcurrentWeakIdentityHashMap

* 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 47s
]
stdout[
:checkDebugClasspath
:preBuild UP-TO-DATE
:preDebugBuild
:compileDebugAidl NO-SOURCE
:compileDebugRenderscript
:checkDebugManifest
:generateDebugBuildConfig
:prepareLintJar
:mainApkListPersistenceDebug
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
:createDebugCompatibleScreenManifests
:processDebugManifest
:splitsDiscoveryTaskDebug
:processDebugResources
:generateDebugSources
:javaPreCompileDebug
:compileDebugJavaWithJavac
:compileDebugNdk NO-SOURCE
:compileDebugSources
:mergeDebugShaders
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets
:transformClassesWithDexBuilderForDebug
:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
20 actionable tasks: 20 executed
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <103137eb219949558cde9ab87892d16a>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <103137eb219949558cde9ab87892d16a>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Qualcuno commented 4 years ago

Your workaround works well. For me the deleted class is on ARCore side. On webrtc side this workaround causes dll not found exception at runtime. Thanks