You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The java binding for org.jetbrains.annotations (named Xamarin.Jetbrains.Annotations) uses the Jetbrains.Annotations namespace. This directly clashes with the .NET JetBrains.Annotations which also uses the Jetbrains.Annotations namespace.
This namespace clash is apparent when using a type that is defined in both the Java and in the .NET version of the library. For example, NotNullAttribute.
Offending line that produces the clashing namespace:
As for fixing this issue, I suggest you change the namespace for the java binding. I don't think the types from the java library are meant to be used in application code, so the name of the namespace probably doesn't matter.
Steps to Reproduce
Create a new android library or application project
using JetBrains.Annotations;namespace AndroidLib1;publicclassClass1{publicvoidTest([NotNull]objectobj){}}
Try to build the project, the build will fail with error
errorCS0433: The type 'NotNullAttribute'existsin both 'JetBrains.Annotations, Version=4242.42.42.42,Culture=neutral,PublicKeyToken=1010a0d8d6380325'and 'Xamarin.Jetbrains.Annotations,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null'
❯ dotnet build AndroidLib1
MSBuild version 17.9.8+b34f75857 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
S:\code\TestConsoleApp1\AndroidLib1\Class1.cs(7,23): error CS0433: The type'NotNullAttribute' exists in both 'JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325' and 'Xamarin.Jetbrains.Annotations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' [S:\code\TestConsoleApp1\AndroidLib1\AndroidLib1.csproj]
Build FAILED.
S:\code\TestConsoleApp1\AndroidLib1\Class1.cs(7,23): error CS0433: The type'NotNullAttribute' exists in both 'JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325' and 'Xamarin.Jetbrai ns.Annotations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' [S:\code\TestConsoleApp1\AndroidLib1\AndroidLib1.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.45
The text was updated successfully, but these errors were encountered:
…ations`
This conflict was most noticeable when using `[NotNull]` in osu!
ppy/osu@9c22fa3
This doesn't fix the conflict in o!f.Android, but it does fix it for downstream projects.
If a fix is needed for o!f, PackageReference Aliases can be used.
More info: xamarin/AndroidX#885
…ations`
This conflict was most noticeable when using `[NotNull]` in osu!
ppy/osu@9c22fa3
This doesn't fix the conflict in o!f.Android, but it does fix it for downstream projects.
If a fix is needed for o!f, PackageReference Aliases can be used.
More info: xamarin/AndroidX#885
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
MSBuild version 17.9.8+b34f75857 for .NET 8.0.204
Description
First noticed in ppy/osu@9c22fa3.
The java binding for
org.jetbrains.annotations
(named Xamarin.Jetbrains.Annotations) uses theJetbrains.Annotations
namespace. This directly clashes with the .NET JetBrains.Annotations which also uses theJetbrains.Annotations
namespace.This namespace clash is apparent when using a type that is defined in both the Java and in the .NET version of the library. For example,
NotNullAttribute
.Offending line that produces the clashing namespace:
AndroidX/Directory.Build.props
Line 74 in 3c8325e
As for fixing this issue, I suggest you change the namespace for the java binding. I don't think the types from the java library are meant to be used in application code, so the name of the namespace probably doesn't matter.
Steps to Reproduce
JetBrains.Annotations.NotNullAttribute
Did you find any workaround?
Add this to the project. Taken from https://stackoverflow.com/questions/9194495/type-exists-in-2-assemblies/65127159#65127159.
Relevant log output
The text was updated successfully, but these errors were encountered: