Eclipse Content is not allowed in prolog

前端 未结 14 1773
抹茶落季
抹茶落季 2021-01-07 22:32

I\'m having trouble opening my main in my eclipse project. It keeps coming up with:

\"content is not allowed in prolog\"

I haven\'t altered my code or anythi

相关标签:
14条回答
  • 2021-01-07 23:06

    i delete the c:/users/your_computer/appdata/.gradle/cache and it went go to normal

    0 讨论(0)
  • 2021-01-07 23:14

    Restarting Eclipse and Cleaning the problem dint help. I opened the .xml file in a XML editor and did a Validate on that error alone. this solved my problem. Hope this helps for people who still got the problem

    0 讨论(0)
  • 2021-01-07 23:15

    Yeah, I had the same, and the first line in strings.xml:

    <?xml version="1.0" encoding="utf-8"?>
    

    was marked with this error. Though I also didn't alter any code, yesterday, when I closed Eclipse, everything was fine, no errors (though some warnings were present, but that doesn't matter, I think)

    All I did now is Selecting this line, Ctrl+X (Cut) it, Ctrl+S to save, Ctrl+V (Paste) it back and Ctrl+S again, and the error is gone. Not sure if it will work for everybody, but it did for me 8)

    0 讨论(0)
  • 2021-01-07 23:16

    I had the same error and figured it out.

    When I tried to create a new string resource, I tried to paste the new resource value on the "Android Resources" screen. To my surprise, the paste operation (using CTRL + V) does not work on that screen, and I tried it several times.

    After that I started getting the error. When I switched from the "Android Resources" screen to the raw XML screen of the Strings.xml file, I noticed that all the text that I tried to paste was at the beginning of the file, like this:

    Image content description. Image content description.<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="app_name">My App</string>
    </resources>
    

    And that was causing the error for me.

    0 讨论(0)
  • 2021-01-07 23:21

    Its most likely an encoding problem: (edit in notepad++ and select) encoding utf-8 -BOM

    0 讨论(0)
  • 2021-01-07 23:21

    I fix it with a non - xml file by clearing the file in the text editor, save the empty file and paste it back. (CTRL+A, CTRL+X, CTRL+S, CTRL+V, CTRL+S)

    0 讨论(0)
提交回复
热议问题