Thanks to the comment of Leon Lu - MSFT, I solved it on my part.
When I was updating packages to be used in my Xamarin.Android project I unintentionally installed: Xamarin.Android.Support.Core.UI and Crosslight.Xamarin.Android.Support.Core.UI which in turn gave me the error:java.lang.IllegalArgumentException: already added : Landroid/support/annotation/AnimRes
I cleared my nuget cach and removed the "Crosslight.Xamarin.Android.Support.Core.UI" which solved it on my part.
I wasn't able to use the step that Leon Lu - MSFT proposed, but I did the eqvivalent with commands. As you can see in the steps underneath.
* Try this first *
Before you start these steps I would double check if you have any NuGet-packages which my cause package duplication, remove it and do a build.
If this does not work then try these steps:
- Open the solution that you have a problem with in VS.
- Go to Tools > NuGet Package Manager > Package Manager Settings -> General and hit the "Clear All NuGet Cache(s)
- This should return an error because you have an project open, but if not then skip to step: 6
- Do not close the solution yet, but open "Run" (Windows key + R) and type "cmd" and run these commands: Clearing Local Folders - Microsoft Docs
- dotnet nuget locals http-cache --clear
- dotnet nuget locals global-packages --clear
- dotnet nuget locals temp --clear
- dotnet nuget locals plugins-cache --clear
- Command 2 and 4 should give you an error, which in turn will give you a hint about what packages is in use and may be the reason for the error.
- Now close the VS Solution and run the fail commands. Now all of the commands should have been run successfully.
- Open your solution again. Remove the NuGet which creates the duplication and try to build the solution again.
- Now you should be able to build your project without the error:
java.lang.IllegalArgumentException: already added : Landroid/support/annotation/AnimRes
Hope it helps!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…