Android – how to import facebook sdk in android studio

androidandroid-studiofacebookimportsdk

I really searched for days to find a good tutorial to import the facebook sdk to make a simpel login system.
if the facebook sdk work with the login then I can go on to import contacts and so on.
but everytime I try to import it (tryed like 20 different things) it gave me errors.
I just need a simple explenation for how I get the facebook sdk in android studio.

Best Solution

make sure you have done the following:

first you have to add the following to the dependencies in your app gradle:

compile 'com.facebook.android:facebook-android-sdk:3.21.1'

In your AndroidManifest.xml you have to include the facebook login activity like so :

    <activity
        android:name="com.facebook.LoginActivity"
        android:label="@string/app_name" />
    <activity

also in the app manifest you have to include your app id as a meta-data tag :

  <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/app_id" /> //Create a string resource with your app id

then you can follow this video which is quiet straight forward :

Facebook Official Android SDK Installation Video