Element must be declared error for tag shape

I'm using Android Studio I/O(Preview) 0.3.2

I'm using this example to define background gradient in my app. I get Element must be declared error. enter image description here

I've checked and I'm not find any solutions. Can anyone help me how can I declare that tag in the xml


Solution 1:

This problem was caused by my xml file. My gradient XML file was in the values folder, I solved this problem by moving gradient file to drawable folder

Solution 2:

You could just right click

res

and hit

New

, to create a

Android Resource File

, and choose

Resource Type

to be

Drawable

, and change whatever the default

root element

to

shape

Yeah it's kinda buggy in Android Studio to create a new XML file other than layout and values lol.

hope it can help you!!

Solution 3:

I had the same problem with Android Studio , I created a directory "anim" under "res" then copied the xml file to that one then the error gone.