Solve element selector must be declared Error in Android Studio

How to fix selector, shape, item and set XML file attributes error in Android Studio drawable resource file project error.

External resource XML file is one of the most important for android projects because whenever android developer need to implement any kind of layout related designing like setting up different types of shape at the background of widgets or adding animations or creating custom seekbar ETC. So in android studio the project structure became slightly different from Eclipse and all that type of XML files shows attributes error like ” Solve element selector must be declared Error “. So in this tutorial we are going to solve this problem from our android project so all the developers can easily use custom XML files.

Note : Solution for fixing this problem is very simple all we have to do is create XML resource file into only drawable folder. So in below tutorial we are only learning the way to create resource XML file into drawable folder.

selector_error

How to Solve element selector must be declared Error in Android Studio.

1. Open your project in Android Studio.

2. Select drawable folder.

studio_drawable_folder

3. Now right click on drawable folder -> New -> Drawable Resource File.

Solve element selector must be declared Error in Android Studio

4. Now enter file name and click on OK button to create drawable resource xml file.

New_Drawable_Resource_File

Note:  We have to create XML resource file inside drawable folder to work it correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *