3

I have a problem with this xml file as said in the title. I dont know how to solve the problem as i have already searched a lot and only found answers like use clean or change validation of this type to ignore none of the above worked as i want to clear this problem so that my R will be generet in the gen folder.

Hope someone can see the problem soon as this is my examprojekt im working on and cant get further without solving this error :)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Dekrypter" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" />

</RelativeLayout>

5 Answers5

4

Start your XML with:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE RelativeLayout>
Italo Borssatto
  • 15,044
  • 7
  • 62
  • 88
2

The solution is to put on the top of xml this code. It identify the type of the document to encode!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>

Revalidate the project!

CIAO!!!

TecnoHelp83
  • 59
  • 1
  • 8
1

I retrieve a solution from a bug issue :

  1. Click Window > Preferences > XML > XML Files > Validation
  2. Change the setting 'validating files'>'No grammar specified' from warning to ignore.
  3. Re-validate your project. No more warnings now.

It works for me.

AntoineP
  • 3,035
  • 1
  • 19
  • 22
0

Add

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

To the top of your XML file. This tells the parser that your file is indeed an XML, that it should use XML version 1.0, and that you are using utf-8 encoding.

Without it, the parser doesn't know how it should parse your XML.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
0

First put this :
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xml>
and after that do this structure:
Click Window > Preferences > XML > XML Files > Validation
Change the setting 'validating files'>'No grammar specified' from warning to ignore.
Re-validate your project. No more warnings now.
thank you AntoineP and TecnoHelp83
https://stackoverflow.com/a/19314230/3117196
https://stackoverflow.com/a/22973854/3117196
worked as well