Forum Xamarin.Forms

How to import Facebook-SDK packages in Xamarin forms

I'm currently developing an Xamarin Forms app that needs to authenticate users, using Facebook.
However, I'm having a hard time figuring out the steps to import and use the Facebook-SDK in my project.

My question is: How do I import the following code in point 6 to my Xamarin forms project?

I've already added the Facebook SDK using Gradle extention for Visual Studio 2017.
Nonetheless, I cant figure out point 6

Import the Facebook SDK

To use the Facebook SDK in a project, add it as a build dependency and import the Facebook SDK packages.

Important: If you're adding the SDK to an existing project, start at step 3.

  1. Go to Android Studio | New Project | Minimum SDK.
  2. Select API 15: Android 4.0.3 (IceCreamSandwich) or higher and create your new project.
  3. In your project, open your_app | Gradle Scripts | build.gradle (Project) and add the following repository to the buildscript { repositories {}} section to >download the SDK from the Maven Central Repository:
  • mavenCentral()
  1. In your project, open your_app | Gradle Scripts | build.gradle (Module: app) and add the following compile statement to the dependencies{} section to >compile the latest version of the SDK:
    compile '[4,5)'
  2. Build your project.
  3. Add the following statements to import the Facebook SDK packages:
  • import com.facebook.FacebookSdk;
  • import com.facebook.appevents.AppEventsLogger;


Best Answer


  • Hi,

    The way you are using, build for Android and add it in Xamarin, that will work for Xamarin Android project not for Xamarin Forms.
    Also for adding native Android libraries, you need to follow the steps for consuming Java libraries in C# mentioned in


    Also there are Facebook plugins for Xamarin Android.

  • ChrisvassChrisvass USMember

    Thank you so much!

Sign In or Register to comment.