Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

R8 problem again

Aperta
#12,693 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
android, csharp, java

Direzione di ricerca

Esegui dotnet build -c Release -f net11.0-android37.0 -v:diag -bl con SDK 11.0.100-preview.7.26381.103, quindi esamina gli input classes.jar segnalati obj\Release\net11.0-android37.0\lp\210 e lp\252 e gli avvisi sui pacchetti NU1608. Il lavoro è completato quando la build Release non segnala più tipi androidx.fragment.app.FragmentKt duplicati e la causa della risoluzione dei pacchetti è documentata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area: App+Library Build needs-triage
Android framework version

net11.0-android (Preview)

Affected platform version

VS 2026 Insiders [12120.281]

Description

I tried Preview 7 again after being away from the .NET 11 Android previews since Preview 5, and I hit an R8 failure in a Release build after partially updating some NuGet packages.

Repro: dotnet build -c Release -f net11.0-android37.0 -v:diag -bl
SDK: 11.0.100-preview.7.26381.103
Error: Type androidx.fragment.app.FragmentKt is defined multiple times
R8 reports the duplicate type coming from:
· androidx.fragment.fragment.aar
· androidx.fragment.fragment-ktx.aar
Relevant output:
· obj\Release\net11.0-android37.0\lp\210 is from androidx.fragment.fragment.aar
· obj\Release\net11.0-android37.0\lp\252 is from androidx.fragment.fragment-ktx.aar
My impression is that this may be a package-resolution/versioning issue that R8 is surfacing, rather than a -t:Run or device/deployment issue, since this reproduces with a plain Release build.

My current workaround is to back out some package updates, but I wanted to send the repro first in case this indicates a regression or packaging issue in Preview 7.
I can attach:
· binlog
· full diagnostic output
· dotnet --info
· dotnet workload list
Thanks.

I reported a similar R8 issue #10700 earlier in the preview cycle, so I thought it was worth checking whether this is related or a separate duplicate-class case.

Steps to Reproduce

N/A

Did you find any workaround?

As above

Relevant log output
C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7>dotnet build -c Release -f net11.0-android37.0 -v:diag -bl
Restore succeeded with 9 warning(s) in 0.2s
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Fragment.Ktx 1.8.9.4 requires Xamarin.AndroidX.Fragment (>= 1.8.9.3 && < 1.8.10) but version Xamarin.AndroidX.Fragment 1.9.0 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences 1.2.0.2 requires Xamarin.AndroidX.DataStore (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Android (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Android 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core 1.2.0.3 requires Xamarin.AndroidX.DataStore.Core.OkIO (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.OkIO 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core 1.2.0.3 requires Xamarin.AndroidX.DataStore.Core (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Core.Android (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.Android 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Core.OkIO.Jvm (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.OkIO.Jvm 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1703: Package 'OxyPlot.Xamarin.Android' 1.0.0 uses the deprecated MonoAndroid framework instead of 'net6.0-android' or later. Consider upgrading to a newer version of this package or contacting the package author.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1703: Package 'OxyPlot.Xamarin.Android' 1.0.0 uses the deprecated MonoAndroid framework instead of 'net6.0-android' or later. Consider upgrading to a newer version of this package or contacting the package author.
    info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  OBDNowPros net11.0-android37.0 android-arm64 succeeded with 9 warning(s) (0.6s)
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Fragment.Ktx 1.8.9.4 requires Xamarin.AndroidX.Fragment (>= 1.8.9.3 && < 1.8.10) but version Xamarin.AndroidX.Fragment 1.9.0 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences 1.2.0.2 requires Xamarin.AndroidX.DataStore (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Android (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Android 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core 1.2.0.3 requires Xamarin.AndroidX.DataStore.Core.OkIO (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.OkIO 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core 1.2.0.3 requires Xamarin.AndroidX.DataStore.Core (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Core.Android (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.Android 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Core.OkIO.Jvm (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.OkIO.Jvm 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1703: Package 'OxyPlot.Xamarin.Android' 1.0.0 uses the deprecated MonoAndroid framework instead of 'net6.0-android' or later. Consider upgrading to a newer version of this package or contacting the package author.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1703: Package 'OxyPlot.Xamarin.Android' 1.0.0 uses the deprecated MonoAndroid framework instead of 'net6.0-android' or later. Consider upgrading to a newer version of this package or contacting the package author.
    *** Building with .NET SDK Version: 11.0.100-preview.7.26381.103 ***
  OBDNowPros net11.0-android37.0 failed with 1 error(s) and 9 warning(s) (4.8s) → bin\Release\net11.0-android37.0\OBDNowPros.dll
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Fragment.Ktx 1.8.9.4 requires Xamarin.AndroidX.Fragment (>= 1.8.9.3 && < 1.8.10) but version Xamarin.AndroidX.Fragment 1.9.0 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences 1.2.0.2 requires Xamarin.AndroidX.DataStore (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Android (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Android 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core 1.2.0.3 requires Xamarin.AndroidX.DataStore.Core.OkIO (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.OkIO 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core 1.2.0.3 requires Xamarin.AndroidX.DataStore.Core (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Core.Android (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.Android 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.DataStore.Preferences.Core.Android 1.2.0.2 requires Xamarin.AndroidX.DataStore.Core.OkIO.Jvm (>= 1.2.0.2 && < 1.2.1) but version Xamarin.AndroidX.DataStore.Core.OkIO.Jvm 1.2.1 was resolved.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1703: Package 'OxyPlot.Xamarin.Android' 1.0.0 uses the deprecated MonoAndroid framework instead of 'net6.0-android' or later. Consider upgrading to a newer version of this package or contacting the package author.
    C:\Projects - VS2026\Net11Preview\OBDNowProsNetPrev7\OBDNowPros.csproj : warning NU1703: Package 'OxyPlot.Xamarin.Android' 1.0.0 uses the deprecated MonoAndroid framework instead of 'net6.0-android' or later. Consider upgrading to a newer version of this package or contacting the package author.
    *** Building with .NET SDK Version: 11.0.100-preview.7.26381.103 ***
    MSBUILD : java.exe error JAVA0000:
      Error in obj\Release\net11.0-android37.0\lp\210\jl\classes.jar:androidx/fragment/app/FragmentKt.class:
      Type androidx.fragment.app.FragmentKt is defined multiple times: obj\Release\net11.0-android37.0\lp\210\jl\classes
      .jar:androidx/fragment/app/FragmentKt.class, obj\Release\net11.0-android37.0\lp\252\jl\classes.jar:androidx/fragme
      nt/app/FragmentKt.class
      Compilation failed
      java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origi
      n: obj\Release\net11.0-android37.0\lp\210\jl\classes.jar
      androidx/fragment/app/FragmentKt.class
        at com.android.tools.r8.internal.lw0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :127)
        at com.android.tools.r8.R8.main(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:5)
      Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Release\ne
      t11.0-android37.0\lp\210\jl\classes.jar:androidx/fragment/app/FragmentKt.class
        at Version.fakeStackEntry(Version_9.1.31.java:0)
        at com.android.tools.r8.r0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:1)
        at com.android.tools.r8.internal.lw0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :81)
        at com.android.tools.r8.internal.lw0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :32)
        at com.android.tools.r8.internal.lw0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :31)
        at com.android.tools.r8.R8.b(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:62)
        at com.android.tools.r8.R8.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:1757)
        at com.android.tools.r8.internal.lw0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :114)
        ... 1 more
      Caused by: com.android.tools.r8.internal.j: Type androidx.fragment.app.FragmentKt is defined multiple times: obj\R
      elease\net11.0-android37.0\lp\210\jl\classes.jar:androidx/fragment/app/FragmentKt.class, obj\Release\net11.0-andro
      id37.0\lp\252\jl\classes.jar:androidx/fragment/app/FragmentKt.class
        at com.android.tools.r8.internal.yp3.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :21)
        at com.android.tools.r8.internal.i83.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :68)
        at com.android.tools.r8.internal.i83.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :24)
        at java.base/java.util.Map.merge(Map.java:1327)
        at com.android.tools.r8.internal.i83.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :23)
        at com.android.tools.r8.dex.c.b(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:36)
        at com.android.tools.r8.R8.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:32)
        at com.android.tools.r8.R8.c(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:11)
        at com.android.tools.r8.R8.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7:1756)
        at com.android.tools.r8.internal.lw0.a(R8_9.1.31_ffb8f76e0cfe19f6a6aff10b55ad38bc82c7544bc91f5b7fd86bc80f9b2412e7
      :28)
        ... 4 more
      Directory 'obj\Release\net11.0-android37.0\lp\210' is from 'androidx.fragment.fragment.aar'.
      Directory 'obj\Release\net11.0-android37.0\lp\252' is from 'androidx.fragment.fragment-ktx.aar'.

Build failed with 1 error(s) and 18 warning(s) in 5.9s
Lingua principale
C#
Stelle
2.1k
Fork
579
Merge medio
2g 5h
PR unite (30g)
206

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/android

Tutte le issue di dotnet/android

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.