Dennis
Dennis

Reputation: 21

The following "version" in the XML declaration must be a quoted string

my activity_main.xml file looks like this:

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

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
    android:layout_width=”fill_parent”
    android:layout_height=”fill_parent”
    android:orientation=”vertical” >

    <TextView
        android:id=”@+id/mytext”
        android:layout_width=”fill_parent”
        android:layout_height=”wrap_content”
        android:text=”@string/hello” />

</LinearLayout>

How am I supposed to fix this error?

Upvotes: 1

Views: 9400

Answers (2)

dan damur ayettey
dan damur ayettey

Reputation: 29

You should declare the version as a char literal not String literal. Exp:

<?xml version='1.0'?>

Upvotes: 2

Jon Skeet
Jon Skeet

Reputation: 1503290

It looks to me as if you've pasted some text from Word or something similar, which means you've got "curly quotes". So your XML declaration looks like this:

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

when it should be like this:

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

Note the difference in quotes. You should fix all the quotes to be regular ASCII quotes... and ideally don't use whatever process you were following to copy and paste text from place to place... it's clearly not friendly to XML or anything else which relies on having regular quotes.

Upvotes: 5

Related Questions