According to the article Add facebook SDK to IntelliJ Android project?, I choose to add the \"facebook.jar\" file as a Module in the \"Dependencies<
OK, finally got the facebook android SDK worked for me. Here are the order of steps I did.
File
| New Module
Library Module
" on the left-side panel.Module name
: "facebook"Content root
: Choose where the downloaded facebook android SDK is, and be sure to select the subfolder named "facebook"Module file location
: same as Content rootPackage name
: com.facebook.android (Guess could assign arbitrarily?)finish
button and wowla~ you got the facebook android sdk module in your project.File
| Project Structure
then select the Modules
pages at the left panelModule Dependency
, you will see the facebook module we created above just shown for selection. Select it.Cloud's solution didn't work for me so I'll post mine below. Specifically, mine didn't work because I was already using the appcompat support library, so this will be especially useful in this case.
ONLY DO THE HIGHLIGHTED STEPS IF YOU ARE ALREADY USING THE APPCOMPAT SUPPORT LIBRARY.
File
-> Project Structure
-> Modules
. Click the green +
-> Import module
. Select the facebook
folder from the facebook SDK
and click OK
.Create module from existing sources
-> Next
-> Next
.
- Click
split (the pink/blue button at the top)
. TypeFacebookDependencies
inName
-> selectbolts..
->OK
. Uncheck the other one (libs?).
Next
-> Next
-> Finish
.
Click the
green +
on the right ->2. Library
-> (the library that contains your android-support-v4.jar - you can check in theLibraries
page on the left) ->Add Selected
.Click the
green +
on the right ->3. Module Dependency
->appcompat
->OK
.
Click your module
.
Click the green +
on the right -> 2. Library
-> FacebookDependencies
(or whatever name it had previously in step 3) -> Add Selected
.
Click the green +
on the right -> 3. Module Dependency
-> facebook
-> OK
.
i had same problem but i'm using eclipse so my steps to solve this problem using eclipse :
1-in eclipse after you import facebook sdk to your workspace right click on FacebookSDk library then chose properties or press Alt + enter 2 - chose "java build path" from leth then go to Libraries Tab
3- click "add external jars" then go to facebook sdk path or location chose libs folder add android-support-v4 file and bolts file
now you done you are happy
i hope this halps
A much simpler approach is to import the Facebook SDK as an AAR library in your Android app's Gradle build. For doing so, I suggest not to reinvent the wheel and use the facebook-api-android-aar project (see https://github.com/mente/facebook-api-android-aar) instead. As explained on this project's documentation (in the README.md file) the simple way is to use a pre-built Maven artifact of the Facebook SDK, by adding the following code in your application's build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
}
}
repositories {
mavenCentral()
mavenLocal()
maven {
url "http://mente.github.io/facebook-api-android-aar"
}
}
apply plugin: 'android'
dependencies {
compile ('com.facebook:facebook-android-sdk:+@aar') {
transitive = true
}
// other dependecies definition here
}
android {
//android build setup
}
That's it. Note that this tool support version 3.0.2, 3.5.0, 3.5.2, 3.6.0, 3.7.0, 3.8.0, 3.14.1, 3.15.0, 3.16 of the Facebook SDK.
Ciao