Hormigas
Hormigas

Reputation: 1449

Basic Android XML Error

Here's a screenshot pertaining to the error I'm encountering

How can I fix this ?

error

I'd really appreciate some help

This is the XML code :

 <?xml​version="1.0" ​encoding="utf-8"?>
    <LinearLayout​xmlns:android="http://schemas.android.com/apk/res/android"
​​​    android:orientation="vertical"
​​​​    android:layout_width="fill_parent"
​​​    ​android:layout_height="fill_parent"​>
    <TextView​​
​​​​    android:layout_width="fill_parent"​
​​​​    android:layout_height="wrap_content"​
​​​​    android:text="@string/hello"​/>
​​​​
    <TextView
​​​​    android:layout_width="fill_parent"
​​​​    android:layout_height="wrap_content"
​​​​    android:text="This is my first Android Application!" />
    <Button
​​​​    android:layout_width="fill_parent"
​​​​    android:layout_height="wrap_content"
​​​​    android:text="And this is a clickable button!" />
​​​​
    </LinearLayout>

Upvotes: 0

Views: 1028

Answers (2)

Harsh Agrawal
Harsh Agrawal

Reputation: 172

I believe there is no string named "hello" in Strings.xml (in res->values).

Please check, probably this should solve your problem.

Upvotes: 3

Michael Celey
Michael Celey

Reputation: 12745

LinearLayout​xmlns:android="http://schemas.android.com/apk/res/android"

Needs to be

LinearLayout ​xmlns:android="http://schemas.android.com/apk/res/android"

Without that space, the first XML tag is invalid.

Full XML would be:

<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:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="This is my first Android Application!" />

    <Button android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="And this is a clickable button!" />

</LinearLayout>

Upvotes: 3

Related Questions