Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms error while writing anim R$anim.class

Hello i am update to visual studio community 2017 15.5 on debug i have this error

obj\Debug\android\src\android\support\compat\R.java:11: error: error while writing anim: obj\Debug\android\bin\classes\android\support\compat\R$anim.class (El proceso no tiene acceso al archivo porque está siendo utilizado por otro proceso)
3>      public static final class anim {
3>                          ^
3>  Note: Some input files use or override a deprecated API.
3>  Note: Recompile with -Xlint:deprecation for details.
3>  Note: Some input files use unchecked or unsafe operations.
3>  Note: Recompile with -Xlint:unchecked for details.
3>  1 error
like image 854
Alexei Sarmiento Avatar asked Dec 05 '17 16:12

Alexei Sarmiento


1 Answers

EDIT: This bug should be fixed now if you update to Visual Studio version 15.5.2 https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#15.5.2 "Release Date: December 14, 2017 - Visual Studio 2017 version 15.5.2 Top Issues Fixed in this Release These are the customer-reported issues addressed in this release:

Xamarin Android project cannot build because R$anim.class is in use."

Short Answer

1- Open the task manager, and kill the MSBuild.exe operation.

2- If 1 didnt work, close and re-open Visual Studio 2a. Also make sure you close the emulator. (edit)

Longer Answer-

I’ve started to occasionally get the same build errors which is some variation of “Xamarin Android project cannot build because R$anim.class is in use”

I’m looking into it and it looks like this is a pretty recent issue they are having since the Xamarin Android 15.5 release. Here’s a link to a thread where the bug is being reported and actively getting worked on. As of the time of this email a fix hasn’t has been pushed yet, but there is a quick fix that worked for me. https://developercommunity.visualstudio.com/content/problem/155693/xamarin-android-project-cannot-build-because-ranim.html

It appears the issue is in some way tied to the MSBuild processes. Open the task manager, and kill the MSBuild.exe operation.

After that, maybe a clean and rebuild, the android emulator seems to work. If that doesn’t work, closing and re-opening VS seems to do the trick. But I would try the task manager first, it might be a faster way to clear the error.

Edit - I also close the emulator while I'm restarting my visual studio. I could be wrong on this, but it looks like it keeps making extra instances of MSbuild.exe and needs a good close and re-launch.

like image 196
Tim Avatar answered Sep 29 '22 09:09

Tim