Ashish Tiwari
Ashish Tiwari

Reputation: 2246

Drawable is not recognised for Android project in Visual Studio

I am working on a Xamarin Android project in Visual Studio. I am trying to add a xml file in drawable folder, it gets added but no resource id is being generated for it. Same thing is happening with image files.

It was working before as, I have added many images and drawables but now its not working.

So please suggest what can I do to add and use them.

Thanks!

Upvotes: 0

Views: 1634

Answers (3)

For anyone who is in this situation with Visual Studio 2022 the problem lies in the selection of the file type, i.e. it is not enough just to name the file with the .xml extension but you have to select "XML File" from the file list otherwise it will not be added . I hope this can be of use to someone.

Upvotes: 0

York Shen
York Shen

Reputation: 9084

I am trying to add a xml file in drawable folder, it gets added but no resource id is being generated for it.

Check if the resource id has been generated in Resource.designer.cs. If it has not been generated, usually clean and rebuilding the project will generate it again , unless there is a syntax error somewhere.

Upvotes: 1

Uraitz
Uraitz

Reputation: 496

be sure that images doesn't have '-' symbol. For example home-button.png remove it or use '_' instead.

Upvotes: 1

Related Questions