How can i add facebook SDK to android project?

后端 未结 4 694
野趣味
野趣味 2020-12-16 02:07

I\'m trying to add facebook SDK to android project but I\'m unable to add it, I couldn\'t do it. My project has one package and there are 8-10 packages in it so where can I

4条回答
  •  离开以前
    2020-12-16 02:26

    I succeeded in adding the Facebook SDK to my app as follows :

    • Download the Facebook SDK from their developer page. Extract it in your local file system. It contains the folder named facebook which inturn contains this .aar package. (facebook-android-sdk-4.23.0.aar)

    • Right click on the project -> New -> Module

    • Select the Import .JAR/.AAR package option.

    • Select the above mentioned .aar file.

    • In the build.gradle file of your app add the following to the dependencies section.

      dependencies {
      ...
      compile 'com.android.support:appcompat-v7:26.+'
      ...
      compile project(':facebook-android-sdk-4.23.0')
      testCompile 'junit:junit:4.12'
      

      }

    • Build your project and you are good to go!

    Note: If you want to check if it is working try adding import com.facebook.FacebookSDK to your MainActivity.java file. If it doesn't show any errors, you have succesfully added the Facebook SDK.

提交回复
热议问题