-2

I usually run my apps without any kind of problems. But, recently, I faced this problem in colors.xml : "Element project must be declared"..... How can I solve it???

oi

Zoe
  • 27,060
  • 21
  • 118
  • 148
Elliomara
  • 21
  • 2
  • 4
  • That doesn't look like the correct format for `colors.xml` at all. It should comprose of a number of `` tags contained within a `` tag. How did you get your file in that state in the first place? – Michael Dodd Mar 14 '19 at 20:39
  • This is an example of what a `colors.xml` file should look like: https://gist.github.com/sghael/2930380 – Michael Dodd Mar 14 '19 at 20:40
  • Dupe of https://stackoverflow.com/questions/53249677/android-studio-shows-wrong-file-contents – Zoe Mar 14 '19 at 20:41
  • 2
    @Zoe Good catch! I thought that had been resolved by now? – Michael Dodd Mar 14 '19 at 20:43
  • @MichaelDodd possibly, but if that's the case, I'm assuming that's an rc patch and not a full release. And even then, rollout is slow – Zoe Mar 14 '19 at 20:44
  • @MichaelDodd I don't know how did I get this file. I didn't even edit it. I was learning Android Development, I run the app like ordinary and I got that problem.... – Elliomara Mar 14 '19 at 22:23

1 Answers1

0

This color file in your picture is not so related to colors.xml - it should look like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#795548</color>
    <color name="colorPrimaryDark">#6B4A3E</color>
    <color name="colorAccent">#FF000000</color
</resources>
Michael Dodd
  • 10,102
  • 12
  • 51
  • 64
Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53