0

I'm fairly new to android programming and I'm getting a weird error that is causing my app to not compile.

Here is my code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="three" />
</LinearLayout>

It gives me "error: Error parsing XML: unbound prefix"

hichris123
  • 10,145
  • 15
  • 56
  • 70

1 Answers1

1

You need to add the namespace declaration xmlns:android="http://schemas.android.com/apk/res/android" to your LinearLayout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
 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"
 android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="three" />
</LinearLayout>
Szymon
  • 42,577
  • 16
  • 96
  • 114