Recently transferred a project from Eclipse to Android Studio. The project uses some XML resources in the ring-letter demo, and after the conversion, it is found that the label of the color resource folder such as Layer-list or shape, element XXX must be declared error, The main idea is that layer-list or shape these tags are not defined.
These tags, such as layer-list or shape, are commonly used tags, and Android studio does not have a definition error, but it does not have this problem in eclipse. Many people on the web say that this is a bug in Android studio, which is the opposite, which is the advantage of Android Studio.
The first thing you need to know about this problem is what these tags are, such as layer-list, shape, and so on. Each label has a corresponding resource class, layer-list, shape, and so on is actually a drawable resource. Layer-list will eventually resolve to Layerdrawable,shape will resolve to shapedrawable, the other tags are similar. It can be seen that layer-list or shape and other resources are drawable resources, should be placed under the Drawable Resource folder. The color resource does not include the drawable resource, and of course does not define a label for the drawable type.
Unlike Android Studio, Eclipse does not have a strict check on resource types, so there is no reporting error. I think this is the advantage of Android Studio, is what resources should be put where, not easy to create confusion. So the solution under Android Studio is to move these resource files to the Drawable resource folder, and this problem is resolved.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Troubleshoot Android Studio under element Layer-list must be declared issues