Reputation: 657
Resource.designer.cs Not Updating in Xamarin.Droid project.
I tried all of the posts below that i might think this is a duplicate post:
Resource.designer.cs NOT regenerating in Mono (Xamarin Studio)
Adding new strings to resource.resx not reflecting into Designer.cs
Xamarin Resource.Designer.cs not refreshing new id's or events
Also tried official link from Xamarin:
I tried this one from Codeproject where it says [Solved] But also didn't work for myself:
Upvotes: 17
Views: 13409
Reputation: 7444
For me this was linked to the error:
"aapt.exe" exited with Code 1.
The cause was a file containing a hyphen or space in my project, which stopped Resources.Designer.cs
updating.
In my case the reason the file existed was me creating a backup by copying of it in the solution, which caused it to copy from my_xml_file.xml
to my_xml_file - Copy.xml
.
Upvotes: 0
Reputation: 1679
Not sure if this is the place to put this answer, but I thought I will share this, specifically for VS 2017 users.
If you updated Xamarin Android with version 8.3.0.19 or Visual Studio 2017 to version 15.7.2, You will have to set the property CustomTool
of the resource to MSBuild:UpdateGeneratedFiles
Select the resource in the solution explorer
, hit f4/right-click and select Properties from the context menu, and set the property CustomTool
to MSBuild:UpdateGeneratedFiles
. Clean+Build or Rebuild the project and you should be able to see the values updated in Resources.Designer.cs
Upvotes: 0
Reputation: 194
I had a similar problem where there was an error in a resource file which prevented the resource.designer.cs file from updating. In my case the issue was that I had added a few images which had illegal characters in their file names.
However what is important is how to discover your specific issue because the errors from the Android Asset and Packaging Tool do not show up in the Error List tab in Visual Studio. I had to set the build output verbosity to diagnostic and then search for Task "Aapt". After locating the aapt section, I found the information that allowed me to locate and fix my error at the bottom of the section. I've included it the section of the log:
Executing package -f -m -M C:\Users\billm\AppData\Local\Temp\2xfnjt4r.kaj\manifest\AndroidManifest.xml -J C:\Users\billm\AppData\Local\Temp\2xfnjt4r.kaj ...
res\drawable\keyboard-backspace-long.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:113)
res\drawable\keyboard-backspace-long.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:113)
res\drawable\keyboard-backspace-xlong.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:113)
res\drawable\keyboard-backspace-xlong.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:113)
res\drawable\keyboard-backspace.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:113)
res\drawable\keyboard-button.png: Invalid file name: must contain only [a-z0-9_.] (TaskId:113)
Done executing task "Aapt". (TaskId:113)
Upvotes: 3
Reputation: 438
method1: Delete the file from the project and also delete bin and obj files and then build the project it should work 100% as i use to do that if i face the same problem if that doesn't work always there is another option
method2: close the application i.e, visual studio, map to c-> users-> -> AppData (Hidden File) -> delete xamarin file from local and roaming
Upvotes: 0
Reputation: 1
if Xamarin resource.designer is not updating one easy solution is to:
Once you have generated your axml make sure to save before you begin to code in your new activity.
Hope this will help someone
Upvotes: -2