Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add facebook SDK to IntelliJ Android project?

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?

like image 461
LuxuryMode Avatar asked Aug 31 '11 19:08

LuxuryMode


People also ask

How did you integrate the Facebook SDK in Android app?

Create Your Project To use the Facebook SDK in an Android Studio project, add the SDK as a build dependency and import the SDK. Go to Android Studio | New Project | Minimum SDK. Select API 15: Android 4.0.

How do I get Android SDK for IntelliJ?

From the main menu, choose File | Project Structure and go to Platform Settings | SDKs. Select the Android SDK and make sure that the correct Java version is selected in the Java SDK field.

What is the Facebook SDK?

The Facebook SDK is a set of software components that developers can include in their mobile app to understand how people use the app, run optimized marketing campaigns and enable Facebook login and social sharing.

Can IntelliJ use Android development?

IntelliJ IDEA is one of the popular IDE that is used for developing android applications.


2 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:

sourceslibrary projectproject 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.

like image 102
CrazyCoder Avatar answered Sep 21 '22 09:09

CrazyCoder


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.

like image 32
Mijahn Avatar answered Sep 20 '22 09:09

Mijahn