4

I'm having trouble getting the Facebook SDK (v3.7) to work in my Android Intellij project.

I followed these steps to add the Facebook library as a new module to my project , but I keep getting this error:

java: cannot access android.support.v4.app.Fragment class file for android.support.v4.app.Fragment not found

Here is a screenshot of my module's dependencies:

And this is a screenshot of the Facebook module dependencies:

When I add the v4 support library to my own module, I get a different error:

Android Dex: [FunnyGific] com.android.dex.DexException: Multiple dex files define Lcom/facebook/AccessToken$1;

I tried using the android-support-v4.jar I found in the facebook-android-sdk-3.7/facebook/libs folder, also tried to import it via Maven and I keep getting the same errors. Any ideas here?

The only situation I could get it to work is by adding the Facebook mvn repository, but even in this case I'm getting some strange exception when I try to show the Facebook LoginButton (java.lang.ClassNotFoundException: com.facebook.android.R$color):

<dependency>
    <groupId>fr.avianey</groupId>
    <artifactId>facebook-android-api</artifactId>
    <version>3.8.0</version>
    <type>aar</type>
</dependency>

Running out of ideas, would love some help to get this working.

Community
  • 1
  • 1
Cat
  • 7,042
  • 8
  • 34
  • 36
  • Did you ever manage to figure out how to get this to work? – Coova Jun 16 '14 at 02:01
  • @ItzHoudini I actually switched to Eclipse, Intellij was a waste of time. It was a lot easier to manage the Facebook SDK after the switch, although there's still some funkiness with that support library. In Eclipse I just had to add the Facebook SDK jar (located in the `bin` directory) to Java Build Path > Libraries, and also add the support library to my project's `libs` folder. – Cat Jun 16 '14 at 04:12
  • Ahh. Sucks to have to switch back to eclipse after just getting started with IntelliJ – Coova Jun 16 '14 at 16:45

2 Answers2

1

I just had this issue in IdeaU v14: FragmentActivity not found! enter image description here

1) Library Settings: enter image description here

2) Class Path Add enter image description here

3) Locate Extras>Android>Support>v4 (or whatever version you need) enter image description here

4) Rejoice! red squiggles go away. enter image description here

WernerCD
  • 2,137
  • 6
  • 31
  • 51
0

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. Choose "java build path" from the left panel, 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.

Community
  • 1
  • 1
NoXSaeeD
  • 924
  • 1
  • 7
  • 13
  • thanks for sharing this, I'm looking for Intellij instructions though. I added the support-v4 library as an external library and it still gives me errors. – Cat May 14 '14 at 00:43