Error: "Error parsing XML: XML or text declaration not at start of entity"

Viewed 55694

I am making a Sudoku Android app and I am getting the following errors under main.xml: "error: Error parsing XML: XML or text declaration not at start of entity" Any help would be appreciated. Here is my code. I put '✗' next to the error

  `✗<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@String/continue_label"/>

        <Button
            android:id="@+id/continue_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/continue_label" />

        <Button
            android:id="@+id/new_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/new_game_label"/>

        <Button 
            android:id="@+id/about_button"
            android:layout_Width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/new_game_label"/>

        <Button
            android:id="@+id/exit_button"
            android:layout_Width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/exit_label"/>
    </LinearLayout>

`

7 Answers

in my case, in some info.plist files , there is an empty line in first line that cause this problem ... check info.plist for extra empty line and if there is, delete it .

for more info: https://github.com/ydkhatri/mac_apt/issues/16

one of the possible reason could be that you have declared namespace inside another namespace.. in the xml file. for example `

  <?xml version="1.0" encoding="utf-8"?>
     <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <?xml version="1.0" encoding="utf-8"?>
         <shape xmlns:android="http://schemas.android.com/apk/res/android"
           android:shape="rectangle" >

           <corners
              android:bottomLeftRadius="30dp"
              android:topLeftRadius="30dp" />

         <solid android:color="#CFCFCF" />

         <padding
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp" />

       <size
        android:height="60dp"
        android:width="130dp" />

     </shape>
  </selector>

`

Related