I tried via import module
but I'm always getting
Error:(13, 0) Could not find property 'ANDROID_BUILD_MIN_SDK_VERSION' on project ':facebook'.
I didn't find a tutorial how to use the Facebook SDK with the latest Android Studio...
The Facebook SDK for Android gives you access to the following features: Facebook Login — A secure and convenient way for people to log into your app or website by using their Facebook credentials. Sharing — Enable people to post to Facebook from your app. People can share, send a message, and share to stories.
Using Facebook SDK 3.23 in Android Studio 1.1 preview 2
Two choices :
*Maven Repository for the Facebook SDK.
dependencies { compile 'com.facebook.android:facebook-android-sdk:4.7.0' }
check for the latest version facebook sdk
OR
*Follow the steps below:
1.Download facebook sdk https://developers.facebook.com/docs/android/
2.Unzip the archive facebook-android-sdk-3.23.0
3.File menu->Import Module
4.Chose “facebook” folder inside the unzipped archive.
5.Go to directory facebook/build.gradle change this part
This:
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION defaultConfig { minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION) targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) }
To proper sdk version
example:
compileSdkVersion 21 buildToolsVersion '21.1.1' defaultConfig { minSdkVersion 14 targetSdkVersion 21 }
6.Click your project and press F4 ,go to 'dependencies' tab, click '+', 'module dependency' and select your imported facebook module.
7.Resync and rebuild
For anybody still wondering, there is finally an official Maven repo for the Facebook SDK:
dependencies { compile 'com.facebook.android:facebook-android-sdk:3.20.0' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With