4

I'm getting error parsing xml on line (error). I have my namespace for android and facebook declared so I don't know why...

 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:facebook="http://schemas.android.com/apk/res-auto"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >  

(error) <com.facebook.widget.LoginButton 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="500dp"
        facebook:confirm_logout="false"
        android:id="@+id/login_button"
        facebook:fetch_user_info="true"
        android:layout_centerHorizontal="true"
                    />
    </RelativeLayout> 
Jake
  • 2,877
  • 8
  • 43
  • 62
  • did you include the facebook jar file and add it to your build path? – JoxTraex Mar 01 '13 at 04:57
  • I already have facebooksdk set as a project that is a library, do i still need to add it to my build path ? – Jake Mar 01 '13 at 05:04
  • add facebook sdk as library project. also check their is any error while setting facebook sdk as library. alos make sure that the your facebook sdk project is open or not in eclipse – Kirit Vaghela Mar 01 '13 at 05:16
  • @Jake yes, you MUST include it into your build path so that when it builds the binaries in the build process it will include those compiled jar files from the facebook SDK and THEN you can use those widgets (If they exist and are exposed). – JoxTraex Mar 03 '13 at 04:34
  • @Jake Could please help me solving this issue? I have tried every discussed solution for this error. But I am not able to solve. Any help is appreciated!! – Shikha Shah Sep 11 '13 at 14:04
  • It may help you:- http://stackoverflow.com/questions/15679466/error-parsing-xml-unbound-prefix-with-the-facebook-sdk – pRaNaY Jan 29 '15 at 05:40

4 Answers4

4

You can add this prefix tag: xmlns:facebook="http://schemas.android.com/apk/res-auto"

Sea turtle
  • 467
  • 1
  • 6
  • 17
3

Please see the difference between while setting facebook sdk as Library project

Success enter image description here

failed enter image description here

Kirit Vaghela
  • 12,572
  • 4
  • 76
  • 80
2

There may be some other solutions, but I recommend you must check this check box

enter image description here

while importing Facebook SDK library project into workspace, I also was facing such a problem at least this worked for me, hope will work for you as well!

Arshad Ali
  • 3,082
  • 12
  • 56
  • 99
-1

You should add this in your facebook button:

<com.facebook.widget.LoginButton 
     xmlns:fb="http://schemas.android.com/apk/res-auto"
     android:layout_width="wrap_content"
        .....
Ultimo_m
  • 4,724
  • 4
  • 38
  • 60