编译错误:类型 okio.AsyncTimeout$1 在 Xamarin Forms 项目中定义了多次

问题描述 投票:0回答:1

我们在 Xamarin Forms 项目中遇到与多次定义 okio.AsyncTimeout$1 类相关的编译错误。我们尚未在 Xamarin Forms 项目中直接安装 okio 或 okhttp。这是完整的错误消息:

Severity    Code    Description    Project    File    Line    Suppression State
Error       Error in obj\Debug\130\lp\21\jl\okio.jar:okio/AsyncTimeout$1.class:
Type okio.AsyncTimeout$1 is defined multiple times: obj\Debug\130\lp\21\jl\okio.jar:okio/AsyncTimeout$1.class, obj\Debug\130\lp\6\jl\okhttp-2.3.0-jar-with-dependencies.jar:okio/AsyncTimeout$1.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\130\lp\21\jl\okio.jar
okio/AsyncTimeout$1.class
    at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98)
    at com.android.tools.r8.D8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\130\lp\21\jl\okio.jar:okio/AsyncTimeout$1.class
    at Version.fakeStackEntry(Version_3.3.75.java:0)
    at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75)
    at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
    at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27)
    at com.android.tools.r8.internal.Fj.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2)
    at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
    at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:17)
    at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85)
    ... 1 more
Caused by: com.android.tools.r8.internal.f: Type okio.AsyncTimeout$1 is defined multiple times: obj\Debug\130\lp\21\jl\okio.jar:okio/AsyncTimeout$1.class, obj\Debug\130\lp\6\jl\okhttp-2.3.0-jar-with-dependencies.jar:okio/AsyncTimeout$1.class
    at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14)
    at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
    at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:33)
    at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10)
    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
    at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6)
    at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
    at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110)
    at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
    at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:25)
    at com.android.tools.r8.D8.d(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:606)
    at com.android.tools.r8.D8.c(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1)
    at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24)
    ... 5 more
Directory 'obj\Debug\130\lp\21' is from 'Square.OkIO.dll'.    FoodAllergyFix.Android

Xamarin.forms:5.0.0.2662(最新)

如何解决多次定义okio.AsyncTimeout$1导致的编译错误?我们怎样才能找到哪些包导致了这个错误呢?任何有关如何修复它的指导将不胜感激。

谢谢你。

android xamarin.forms okhttp okio
1个回答
0
投票

终于,我解决了这个问题。 firebase crashlytics 是罪魁祸首。从项目中删除包后问题得到解决。

© www.soinside.com 2019 - 2024. All rights reserved.