.NET MAUI Android 应用程序构建由于 JAVA0000 错误而失败

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

将 Xamarin.Forms 应用程序迁移到

.NET MAUI
并修复不同的问题时,我从解决方案的 Android 部分得到 “Type android.support.v4.app.INotificationSideChannel$Stub$Proxy is Defined multiple times” :

Error JAVA0000 in obj\Debug\net8.0-android\lp\144\jl\classes.jar:android/support/v4/app/INotificationSideChannel$Stub$Proxy.class:
Type android.support.v4.app.INotificationSideChannel$Stub$Proxy is defined multiple times: obj\Debug\net8.0-android\lp\144\jl\classes.jar:android/support/v4/app/INotificationSideChannel$Stub$Proxy.class, obj\Debug\net8.0-android\lp\29\jl\bin\classes.jar:android/support/v4/app/INotificationSideChannel$Stub$Proxy.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\144\jl\classes.jar
android/support/v4/app/INotificationSideChannel$Stub$Proxy.class
    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
    at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\144\jl\classes.jar:android/support/v4/app/INotificationSideChannel$Stub$Proxy.class
    at Version.fakeStackEntry(Version_8.2.33.java:0)
    at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
    at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
    at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
    ... 1 more
Caused by: com.android.tools.r8.utils.b: Type android.support.v4.app.INotificationSideChannel$Stub$Proxy is defined multiple times: obj\Debug\net8.0-android\lp\144\jl\classes.jar:android/support/v4/app/INotificationSideChannel$Stub$Proxy.class, obj\Debug\net8.0-android\lp\29\jl\bin\classes.jar:android/support/v4/app/INotificationSideChannel$Stub$Proxy.class
    at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
    at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
    at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
    at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
        ... 6 more
Directory 'obj\Debug\net8.0-android\lp\144' is from 'androidx.core.core.aar'.

Android项目中的包引用:

<PackageReference Include="CommunityToolkit.Maui.Markup" Version="4.0.0" />
<PackageReference Include="Controls.UserDialogs.Maui" Version="1.5.4" />
<PackageReference Include="IdentityModel.OidcClient" Version="6.0.0" />
<PackageReference Include="Syncfusion.Maui.Core" Version="26.1.38" />
<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.9.0.3" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.9.0.3" />
<PackageReference Include="Xamarin.AndroidX.Collection" Version="1.4.0.5" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.0.4" />
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.13.1.2" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.26" />
<PackageReference Include="Xamarin.Azure.NotificationHubs.Android" Version="1.1.4.1" />
<PackageReference Include="Xamarin.Google.Dagger" Version="2.50.0" />
<PackageReference Include="Xamarin.GooglePlayServices.Base" Version="118.4.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.60" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.60" />

我之前已经在项目文件中修复了多个与显式依赖项相关的

AndroidX
相关问题,但这似乎与它们无关。

android .net xamarin maui androidx
1个回答
0
投票

我设法从该错误中恢复的唯一方法是从我正在使用的 bitbucket 存储库克隆 Visual Studio 解决方案代码。 我从一个全新的文件夹开始。 我唯一缺少的是从我开始工作那天起的几行代码。

这对我有用,并且是我读过的所有其他解决方案的更快解决方案,并且应该节省数小时/数天的时间来寻找此问题的答案。

希望这对其他人有帮助。

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