Start your New Android Project
1. Create a new project in Android Studio from File ⇒ New ⇒ Android Application Project .
2. Now minimize or close your Android Studio. Go to your project directory inside it create a new folder.
3. UnZip your facebook SDK folder, now we need to copy facebook project files to our newly created libraries folder. Open your unzip folder and find facebook folder. In my case i found here F:\socialsdk\facebook-android-sdk-3.16.0\facebook-android-sdk-3.16 i extract facebook sdk in f drive inside socialssdk. You find your where you extract sdk files.
Copy this facebook folder to your libraries folder.
4. Now open your copied facebook folder inside libraries and we need to remove some folder which we don’t need in our project and remove other file and folders.
5. Now open your android studio and open your project you create for this. Now find your libraries folder in your project and facebook inside.
5. Open your facebook build.gradle inside facebook folder we need to configure
Libraries ⇒ facebook ⇒ build.gradle
i.e.
android {
compileSdkVersion 21 buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 16 targetSdkVersion 21 versionCode 1 versionName "1.0" }
compileSdkVersion 21 buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 16 targetSdkVersion 21 versionCode 1 versionName "1.0" }
You also copy and paste above code in your build.gradle.
6. Now open your ProjectDirectory ⇒ settings.gradle. In this file we need to include our facebook library.
include ':libraries:facebook'
7. Now you need to configure your project structure shortcut Ctrl+Alts+Shift+S .
After click on button select Module ⇒ Dependencies ⇒ + ⇒ Module Dependencies
include ':libraries:facebook'
7. Now you need to configure your project structure shortcut Ctrl+Alts+Shift+S .
After click on button select Module ⇒ Dependencies ⇒ + ⇒ Module Dependencies
After this select facebook module and click ok button and then Apply and let grable sync after this your Facebook SDK is ready to use in your project.
No comments:
Post a Comment