세상사는 이야기 / 도움이 되었다면 배너 클릭 부탁드려요~ →→→

2019년 11월 6일 수요일

[Unity Android] Unity Ads 추가 에러

Unity Ads를 추가 후 빌드 에러 발생

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.unity3d.ads.BuildConfig found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.IUnityAdsListener found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)


Asset Store에서 최신 버전의 UnityAds를 설치 했지만
Unity가 Project 생성시 자동으로 Package에 Advertisement를 설치해 놓아서 그렇다.

둘중 하나를 지우면된다.

- 내프로젝트

-  Package

 Packages쪽 Ads를 지운다.


에러 전문


Execution failed for task ':checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.unity3d.ads.BuildConfig found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)




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

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.unity3d.ads.BuildConfig found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.IUnityAdsListener found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.UnityAds found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.UnityAds$FinishState found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.UnityAds$PlacementState found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.UnityAds$UnityAdsError found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.mediation.IUnityAdsExtendedListener found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.metadata.InAppPurchaseMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.metadata.MediationMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.metadata.MetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)
  Duplicate class com.unity3d.ads.metadata.PlayerMetaData found in modules classes.jar (:UnityAds:) and classes.jar (:unity-ads:)

  Go to the documentation to learn how to Fix dependency resolution errors.


* 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 9s
]
stdout[

> Configure project :
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2019.2.11f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only

> Task :preBuild UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:preBuild UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:preReleaseBuild UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:checkReleaseManifest
> Task :GooglePlayGamesManifest.plugin:processReleaseManifest
> Task :preReleaseBuild
> Task :GooglePlayGamesManifest.plugin:compileReleaseAidl NO-SOURCE
> Task :compileReleaseAidl NO-SOURCE
> Task :GooglePlayGamesManifest.plugin:packageReleaseRenderscript NO-SOURCE
> Task :checkReleaseManifest UP-TO-DATE
> Task :generateReleaseBuildConfig UP-TO-DATE
> Task :compileReleaseRenderscript NO-SOURCE
> Task :prepareLintJar UP-TO-DATE
> Task :generateReleaseSources UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:compileReleaseRenderscript NO-SOURCE
> Task :GooglePlayGamesManifest.plugin:generateReleaseBuildConfig
> Task :GooglePlayGamesManifest.plugin:generateReleaseResValues
> Task :GooglePlayGamesManifest.plugin:generateReleaseResources
> Task :GooglePlayGamesManifest.plugin:packageReleaseResources
> Task :GooglePlayGamesManifest.plugin:generateReleaseRFile
> Task :GooglePlayGamesManifest.plugin:prepareLintJar UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:generateReleaseSources
> Task :GooglePlayGamesManifest.plugin:javaPreCompileRelease
> Task :GooglePlayGamesManifest.plugin:compileReleaseJavaWithJavac
> Task :GooglePlayGamesManifest.plugin:bundleLibCompileRelease
> Task :javaPreCompileRelease
> Task :mainApkListPersistenceRelease UP-TO-DATE
> Task :generateReleaseResValues UP-TO-DATE
> Task :generateReleaseResources UP-TO-DATE
> Task :createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :mergeReleaseResources UP-TO-DATE

> Task :processReleaseManifest
E:\Work\Project\kor\Temp\gradleOut\src\main\AndroidManifest.xml:12:7-78 Warning:
Element meta-data#android.notch_support at AndroidManifest.xml:12:7-78 duplicated with element declared at AndroidManifest.xml:11:7-78

> Task :processReleaseResources
> Task :compileReleaseJavaWithJavac
> Task :compileReleaseSources
> Task :GooglePlayGamesManifest.plugin:prepareLintJarForPublish UP-TO-DATE
> Task :lintVitalRelease
> Task :mergeReleaseShaders UP-TO-DATE
> Task :compileReleaseShaders UP-TO-DATE
> Task :generateReleaseAssets UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:mergeReleaseShaders
> Task :GooglePlayGamesManifest.plugin:compileReleaseShaders
> Task :GooglePlayGamesManifest.plugin:generateReleaseAssets
> Task :GooglePlayGamesManifest.plugin:packageReleaseAssets
> Task :mergeReleaseAssets
> Task :validateSigningRelease UP-TO-DATE
> Task :signingConfigWriterRelease UP-TO-DATE
> Task :GooglePlayGamesManifest.plugin:bundleLibRuntimeRelease
> Task :checkReleaseDuplicateClasses FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
34 actionable tasks: 21 executed, 13 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <2a151ab0aea840598e2f18fa24d85ada>: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 <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <2a151ab0aea840598e2f18fa24d85ada>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

댓글 2개:

  1. ㅠㅠ 2022년도에 이 문제에 봉착했습니다... 버전이 다르다 보니 상황이 다르네요 흑흑

    답글삭제