R8 problem again
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Domain
- build-system, mobile
Research direction
Run dotnet build -c Release -f net11.0-android37.0 -v:diag -bl with SDK 11.0.100-preview.7.26381.103, then inspect the reported obj\Release\net11.0-android37.0\lp\210 and lp\252 classes.jar inputs and the NU1608 package warnings. Done means the Release build no longer reports duplicate androidx.fragment.app.FragmentKt types, with the package-resolution cause documented.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 581
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 212
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/android
-
Area: App+Library Build
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Area: Debugger enhancement needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Area: Mono.Android
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dotnet/android#9192 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 5/5 Over a week Newbie friendliness 25/100
dotnet/android#12981 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
lay295/TwitchDownloader#1675 ·
-
copilot documentation
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
space-wizards/RobustToolbox#7119 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 4 days
-
.NET Bug Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-dotnet#5666 · 2 comments ·
Maintainers usually reply within 2 days