How to create working facebook login button?

How can I create working facebook login button? I read documentations and looked at the examples all over the internet, but when I try to run my app, I'm getting unknown exception which I can't understand where and why it's coming...

This is the error I'm getting:

Now, the code which made this error appear is:

FacebookLoginView.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:minWidth="25px"
    android:minHeight="25px">
    <com.facebook.login.widget.LoginButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/loginButton1"
        android:layout_gravity="center_horizontal" />
</LinearLayout>

FacebookLoginView.cs

namespace Liker2.Client.Droid.Views
{
    [Activity(Label = "Facebook login")]
    class FacebookLoginView : MvxActivity
    {
        private LoginButton loginButton;

        protected override void OnCreate(Bundle bundle)
        { 
            base.OnCreate(bundle);
            FacebookSdk.SdkInitialize(ApplicationContext);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.FacebookLoginView);          
        }
    }
}

in FacebookLoginView class I saw that after SetContentView(Resource.Layout.FacebookLoginView) executes the method finishes and then the exception occurs...

Could someone please explain me what is the problem???

BTW:
I am using:
Visual Studio 2017 Community 2017 Version 15.3.3
Xamarin 4.6.0.299
Xamarin.Android SDK 7.4.0.21
My app:
Target Framework (Android 7.1 (Nougat))
Minimum Android Version (Android 5.0(API Level 21 - Lollipop))
Target Android Version (Android 7.1(API Level 25 - Nougat))
Xamarin.Facebook.Android 4.24.0

Sign In or Register to comment.