0

Xml declaration should proceed all document content

Suddenly I am getting this error in my android project and i have not made any changes , but yet this popped up ,with some auto generated java code.

enter image description here

have tried commenting the above , but thats not working so tried adding the following code to make it correct

<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
    <color name="your_color">#FFFFFF</color>
</resources>

still nothing happened.

this is the error

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Ankita Basu
  • 51
  • 2
  • 10

2 Answers2

3

Because a space is created before the first line of code :

 <?xml version="1.0" encoding="utf-8"?>
hossein
  • 638
  • 1
  • 3
  • 14
2

This is because XML files should only contain valid XML markup and not contain Java code. Change the contents of your XML file to exclude the Java code by either commenting it out with <!-- (Contents of comment) --> or by deleting the Java code altogether.

Edric
  • 24,639
  • 13
  • 81
  • 91