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!

How to solve Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V in Android

So today, while writing an example for the JCG community, I came across the following exception, while trying to add an EditText element to my application:

Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V

Despite the fact that I selected Android 4.4 (API 19) for my application, I noticed that the selected Android API in the Graphical Layout of my XML code was actually wrong:

So, the easy way, I clicked the dropdown to select again my initial option:

Note: the Wear versions don’t support EditText elements and that’s why we got the exception.

And of course, everything was fine after that:

Cheers!