unity3d Unity Android构建错误重复类

eulz3vhy  于 2023-03-03  发布在  Android
关注(0)|答案(2)|浏览(217)

Unity版本:统一2020.1.17f
Android的游戏后,我得到了这些错误
在播放器设置中,我选中了自定义主清单,自定义启动器清单,自定义启动器Gradle模板和自定义Gralde属性模板
我什么都试过了,请帮帮我
当我制作Android Resolver时发生此错误

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class android.support.customtabs.ICustomTabsCallback found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.ICustomTabsCallback$Stub found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.ICustomTabsCallback$Stub$Proxy found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.ICustomTabsService found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.ICustomTabsService$Stub found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.ICustomTabsService$Stub$Proxy found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.IPostMessageService found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.IPostMessageService$Stub found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.customtabs.IPostMessageService$Stub$Proxy found in modules browser-1.0.0-runtime.jar (androidx.browser:browser:1.0.0) and jetified-androidx.browser.browser-1.0.0-runtime.jar (:androidx.browser.browser-1.0.0:)
  Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.3.2-runtime.jar (:androidx.core.core-1.3.2:)
  Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.3.2-runtime.jar (:androidx.core.core-1.3.2:)
  Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.3.2-runtime.jar (:androidx.core.core-1.3.2:)
  Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.3.2-runtime.jar (:androidx.core.core-1.3.2:)
  Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.3.2-runtime.jar (:androidx.core.core-1.3.2:)
  Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.3.2-runtime.jar (:androidx.core.core-1.3.2:)
  Duplicate class androidx.annotation.AnimRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.AnimatorRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.AnyRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.AnyThread found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.ArrayRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.AttrRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.BinderThread found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.BoolRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.CallSuper found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.CheckResult found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.ColorInt found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.ColorLong found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.ColorRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.ContentView found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.DimenRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.Dimension found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.DrawableRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.FloatRange found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.FontRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.FractionRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.GuardedBy found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.HalfFloat found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.IdRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.InspectableProperty found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.InspectableProperty$EnumEntry found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.InspectableProperty$FlagEntry found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.InspectableProperty$ValueType found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.IntDef found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.IntRange found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.IntegerRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.InterpolatorRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.Keep found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.LayoutRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.LongDef found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.MainThread found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.MenuRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.NavigationRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.NonNull found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.Nullable found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.PluralsRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.Px found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RawRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RequiresApi found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RequiresFeature found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RequiresPermission found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RequiresPermission$Read found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RequiresPermission$Write found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RestrictTo found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.RestrictTo$Scope found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.Size found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.StringDef found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.StringRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.StyleRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.StyleableRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.TransitionRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.UiThread found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.VisibleForTesting found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.WorkerThread found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.annotation.XmlRes found in modules annotation-1.1.0.jar (androidx.annotation.annotation-1.1.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
  Duplicate class androidx.arch.core.executor.ArchTaskExecutor found in modules core-runtime-2.0.1-runtime.jar (androidx.arch.core:core-runtime:2.0.1) and jetified-androidx.arch.core.core-runtime-2.0.1-runtime.jar (:androidx.arch.core.core-runtime-2.0.1:)
  Duplicate class androidx.arch.core.executor.ArchTaskExecutor$1 found in modules core-runtime-2.0.1-runtime.jar (androidx.arch.core:core-runtime:2.0.1) and jetified-androidx.arch.core.core-runtime-2.0.1-runtime.jar (:androidx.arch.core.core-runtime-2.0.1:)
  Duplicate class androidx.arch.core.executor.ArchTaskExecutor$2 found in modules core-runtime-2.0.1-runtime.jar (androidx.arch.core:core-runtime:2.0.1) and jetified-androidx.arch.core.core-runtime-2.0.1-runtime.jar (:androidx.arch.core.core-runtime-2.0.1:)
  Duplicate class androidx.arch.core.executor.DefaultTaskExecutor found in modules core-runtime-2.0.1-runtime.jar (androidx.arch.core:core-runtime:2.0.1) and jetified-androidx.arch.core.core-runtime-2.0.1-runtime.jar (:androidx.arch.core.core-runtime-2.0.1:)
  Duplicate class androidx.arch.core.executor.DefaultTaskExecutor$1 found in modules core<message truncated>
5sxhfpxr

5sxhfpxr1#

当您使用不同版本的播放服务解析程序导入多个SDK时,经常会发生此错误。

    • 解决方案:**
  • 删除已解析的库并再次解析
  • 资源〉播放服务解析器〉Android解析器〉删除已解析的库
  • 资源〉播放服务解析器〉Android解析器〉解析
  • 再次包含SDK
  • 删除导入的SDK
  • 再次导入SDK,但这次只检查一个工具的解析程序
  • 资源〉播放服务解析器〉Android解析器〉解析
  • 手动删除重复类(最坏情况下)
  • 在资源〉播放服务解析器〉Android解析器〉设置中禁用自动解析。
  • 在资源文件夹中找到日志中提到的重复类并将其删除(例如,删除"androidx.annotation.annotation-1.1.0.jar"并保留"annotation-1.1.0.jar")
5lhxktic

5lhxktic2#

    • 适用于Unity 2019.4或更低版本**
  • 使用播放服务解析程序来解析依赖项。

  • Assets > Play Services Resolver > Android Resolver > Resolve

    • 适用于Unity 2020+版本**
  • 使用外部依赖关系管理器解析依赖关系。

  • Assets > External Dependency Manager > Android Resolver > Resolve

相关问题