Question

I have the following android layout xml:

   <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">

       <com.facebook.widget.LoginButton
            android:id="@+id/authButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="30dp"
            />
    </LinearLayout>

However I get runtime error: enter image description here

which can even be seen in the Graphical editor:

enter image description here

But I don't get why, as I have imported the FacebookSDK properly (i think)

and when I do cmd + right click on the XML I get to the right class implementation enter image description here

`package com.facebook.widget;

public class LoginButton extends Button {`

enter image description here

What am I missing?

Was it helpful?

Solution

I have recently done Facebook Android Integration from this link.

When i imported FacebookSDK into my project, I got error in console of android-support-v4.jar mismatch. Because i have 2 android-support-v4.jar files in FacebookSDK Project and in my Project. Due to Which an error is coming at runtime of ClassDefNotFound. So I Deleted one of the jar file.

Check this out if it helps you.

And the SDK provided on the link was not working well. So tried out with different SDK from this Link. And got success with SDK 3.0.2.

I hope this will help you out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top