Monday, December 1, 2014

How to solve Error parsing XML: unbound prefix for com.facebook.widget.ProfilePictureView in Android

Hey people,

these days I'm working with Android Facebook SDK, a field that I'm pretty new, too, so I considered sharing a little experience that I recently faced.

Supposing that you want to connect your app to Facebook, you obviously need a login button, first of all., so your xml code should look like this:



Ok, nothing special, but if you want to add the user's profile picture too, see what happens:

Error parsing XML


And this is what the console logs:

C:\Workspaces\eclipse_luna\FacebookApp\res\layout\activity_main.xml:14: error: Error parsing XML: unbound prefix

So, if you 've already read that, but didn't find a solution, here is the single line that you need to your namespaces:
xmlns:facebook="http://schemas.android.com/apk/res-auto"

Now, everything seems to work, without any errors:


Cheers!