简体   繁体   中英

Facebook Android SDK and IntelliJ IDEA

Has anyone figured out how to use the Facebook SDK with an IntelliJ project successfully? I have tried to create a module, mess with project structure etc, but it does not seem to work on compilation.

Does anyone have an answer to this? All other sources seem to be outdated.

This is what actually worked for me.

However, instead of selecting "Library Module" just hit "Empty Module." This was a pain to figure out, but Intellij will change a bunch of files including the AndroidManifest.xml & Strings.xml if you hit "Library Module." Also, be sure to add the dependencies to the libs folder in the recursed directory to your Facebook module so you include android-support-v4 & bolts support. Should work then.

I am currently using the Facebook Android SDK with IntelliJ.

What you need to do is add the SDK as a library for your project.

  1. First, build Facebook Android SDK using Gradle
  2. Open project settings, under Libraries, select Java
  3. Navigate to the Facebook Android SDK directory, select the facebook sub-directory and click OK
  4. The next screen will show a check-list of items, mostly directories - each of them will be classified as source, class etc.
  5. Uncheck everything, and then check the following items:
    • facebook-android-sdk/facebook/build/classes/release
    • facebook-android-sdk/facebook/gen
    • facebook-android-sdk/facebook/src
  6. Then, click Next/OK/Finish

This might be sufficient, but in my case I had to go the Module settings, Dependencies tab and move the facebook item above the project sources item to get the module to compile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM