Home » Android » Add facebook SDK to IntelliJ Android project?

Add facebook SDK to IntelliJ Android project?

Posted by: admin June 15, 2020 Leave a comment


How can I add the facebook sdk to my android project in IntelliJ? I’m familiar with how to add a library project to an existing project in Eclipse, but not in IntelliJ. Anyone know how?

How to&Answers:

The answer below is outdated, please refer to the actual solution.

If it’s just a jar, you can add it to the module dependencies.

If you want to use Android Library with source code, you need to create a new Module in IDEA with Android Facet and specify in the facet settings that it’s Android Library Project. Configure module content and source roots and then add this module as a dependency to your Android application module.

Here are the screenshots for the Facebook SDK Android Module configuration in IDEA:

library project
project view

Note that the root of the module is set to the facebook subdirectory from the GitHub repository and Is Library Project checkbox is enabled.

If you add this module as a dependency to your application, everything should build fine.

I’ve also uploaded a sample project that consists of simple sample provided with the SDK and this facebook API module as a dependency, you can download and use it for reference.


Remove if inappropriate – but this solution was much more relevant for the latest version of IDEA and the latest Facebook SDK: https://stackoverflow.com/a/14732898/1711200

Tested with IDEA 12.1.2 and Facebook SDK 3.0.1

My reason for posting this is because the directory structure for the latest Facebook SDK is different & makes this post outdated. I also kept getting directed to this thread, whereas the thread I’ve linked to is a better & more relevant solution.