突然,Gradle无法构建并引发以下错误:
CommandInvokationFailure:Gradle构建失败。 D:\ Unity \ Editor \ Data \ PlaybackEngines \ AndroidPlayer / Tools \ OpenJDK \ Windows \ bin \ java.exe -classpath“ D:\ Unity \ Editor \ Data \ PlaybackEngines \ AndroidPlayer \ Tools \ gradle \ lib \ gradle-launcher- 4.6.jar“ org.gradle.launcher.GradleMain” -Dorg.gradle.jvmargs = -Xmx4096m“” assembleRelease“
stderr [ D8:程序类型已经存在:com.unity3d.ads.BuildConfig
失败:构建失败,并出现异常。
出了什么问题: 任务':transformDexArchiveWithExternalLibsDexMergerForRelease'的执行失败。
com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错:D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 0.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 1.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 2.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 3.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 4.jar,D :\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 5.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 6.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 7.jar,D: \ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 8.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 9.jar, D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 10.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 11。 jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 12.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 13.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 14.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 15.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 16.jar,D:\ Unity Projects \ VegOrNonVeg \ Temp \ gradleOut \ build \ intermediates \ transforms \ dexBuilder \ release \ 17.jar 在https://developer.android.com/studio/build/dependencies#duplicate_classes了解如何解决该问题。 程序类型已经存在:com.unity3d.ads.BuildConfig
尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的见解。
我尝试卸载现有的SDK,然后重新安装Oreo的SDK
我也遇到以下错误: UnityAdsEditor:Initialize(3113808,False); UnityEditor.Advertisements.UnityAdsEditor:EditorOnLoad()
该项目以前没有问题。没有新的更新或任何代码更改。
答案 0 :(得分:0)
问题已解决:
Unity Ads的现有软件包导致了此问题。
转到程序包管理器并删除/更新广告程序包(我的是2.0.8,将其更新为3.0.3)。
转到“编辑”>“项目设置”>“播放器”,然后为“配置”下的“脚本运行时版本”选择.NET 4.x等效版本。
如果可能,请选择“最低API级别”为19或更高。
如果在“项目”窗口的“资产”文件夹中,请确保删除现有的Unity Ads文件夹。