6

I imported the Facebook library following this tutorial: http://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

And now I am ready to compile and try to run the project, but it is not compiling saying that I have an error in my project.

What seems to be the issue is that I have the Facebook library which I imported...it has a red exclamation mark icon next to it, and now my own project has the red exclamation mark icon next to it also since I connected the two.

Would anyone know how to fix this? For the record I don't need any facebook social functionality. What I needed was to connect my project with the appId of a Facebook app I have.

Genadinik
  • 18,153
  • 63
  • 185
  • 284
  • 2
    The exclamation mark means that there is a build problem. Try to find out what causes it. First give a look in the build path settings. – 5agado Apr 28 '13 at 14:08
  • 1
    @5agado yes the build settings have an error saying that the facebook.jar is missing. But there was no facebook.jar to import in the first place. At least I didn't notice it in the download they provided...I'll look again. – Genadinik Apr 29 '13 at 22:16
  • There was no facbooksdk.jar in that downloaded package. – Genadinik Apr 29 '13 at 22:25
  • Did you add the SDK to your project? Right click on your Android app and select Properties. Then go to the option Android and add the imported Facebook SDK to your project. – fje Apr 29 '13 at 22:27
  • @fje yes I did originally add the FacebookSDK into my workspace but that has a red exclamation mark there too. Should I not have added it to the workspace, but rather to the individual project? – Genadinik Apr 29 '13 at 22:30
  • @fje how do I un-import things now? I imported some things I didn't intend to :) Will right-click --> delete do the trick? – Genadinik Apr 29 '13 at 22:31
  • Importing the Facebook SDK into your workspace is just fine. Did you uncheck the "Copy projects into my workspace" option? – fje Apr 29 '13 at 22:40
  • Additionally you can try cleaning the project: Project > clean. – fje Apr 29 '13 at 22:43
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/29144/discussion-between-genadinik-and-fje) – Genadinik Apr 29 '13 at 22:45
  • according to my knowledge I would like to suggest you can use that library code into your project by creating package like com.yourapp.facebook and put that java files into package. The reason behind it is in future you never need to open facebook library or wont send library with your code to the client. – Maulik Apr 30 '13 at 10:34
  • @Maulik I am trying your suggestion. It appeals to me. Facebook also had many layout files. Did you import them too? Or did you just comment them out mostly? – Genadinik Apr 30 '13 at 18:28
  • @Genadinik Look, facebook provide it's own functionality and feature according to general demand or requirement, as far as our application is concern,we should implement those feature that our app requires. it means if we haven't required some of feature then we can be remove or comment it if it doesn't need.(and we can optimize the code as well). – Maulik May 01 '13 at 05:36

8 Answers8

8

Importing Facebook SDK

Make sure, that you have Android SDK 2.3.3 available. Import the Facebook SDK project into your workspace. Then right click on it and go to Properties > Android and choose Android SDK 2.3.3. Maybe cleanup after that and you should go fine.

Referencing to Facebook SDK

Right click on your Android application project and select Properties > Android and add the imported Facebook SDK to your project. There you go!

fje
  • 845
  • 1
  • 13
  • 18
  • Actually, lol, my original project still has the red exclamation mark next to it. Do you know how to get rid of that or why it happened? – Genadinik Apr 30 '13 at 00:39
  • When I right click on my project, and go to Android, and add library, and add the Facebook library, it creates the red exclamation mark on my project. – Genadinik Apr 30 '13 at 00:47
  • I assume that you have to choose Android SDK 2.3.3 for that project too and make sure, that you are using Java Compiler 1.6 (Right click > Properties > Java Compiler) – fje Apr 30 '13 at 06:52
  • and check if you selected the checkbox "Is Library" under right click on FacebookSDK > Properties > Android – fje Apr 30 '13 at 06:57
  • Also check if both projects point to the same _android-support-v4.jar_ (in android Dependencies) – 5agado Apr 30 '13 at 08:22
  • Yes I have the right Java compiler. And the is library checkbox was checked. – Genadinik Apr 30 '13 at 16:56
  • @5agado how can both projects point to the same android-support library? Facebook has one of those too. How can I make it use the library used by my project? – Genadinik Apr 30 '13 at 16:57
  • I also had a problem like yours, in my case was an incompatibility in the libraries (i.e. _android-support-v4.jar_). I resolved by making both projects point to the same lib (in my case the one of Facebook). However it is strange that Eclipse doesn't give you a more accurate reason for the error. Another problem related to that lib: [link](http://stackoverflow.com/questions/12045568) – 5agado Apr 30 '13 at 17:25
  • @5agado How did you make the fb project point to that same lib? The android-support jar is in the lib folder of each of those. – Genadinik Apr 30 '13 at 17:51
  • Delete the one from the non-Facebook-SDK project. Again, see the [previous link](http://stackoverflow.com/questions/12045568) that I posted. – 5agado Apr 30 '13 at 19:59
  • Did you solve that last issue? If not you should also take a look in your AndroidManifest.xml in your project und verify that you stated the minSdkVersion version correctly: – fje May 04 '13 at 10:30
7

You need to fix missing libraries. Right click your project->Properties->Build path->Libraries.

DK250
  • 1,064
  • 13
  • 11
3

Generally speaking, the red exclamation mark indicates a problem with your build path. If you go into the Build Path dialog, you should see something in the Libraries tab that is broken.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
1

I had the same issue.

After re-extracting the facebook SDK and re-importing it to Eclipse, it stopped happening and everything works fine.

I don't have an explanation other than "Eclipse sucks" - it might have something to do with the Eclipse project files and what paths they reference.

SirKnigget
  • 3,614
  • 2
  • 28
  • 61
1

To remove the android-support-v4.jar if it exists in your project which already in Facebook.

0

For me I was getting:

[2013-05-26 23:10:29 - FacebookSDK] Unable to resolve target 'android-8'

when importing the FacebookSDK project.

FacebookSDK > Properties > Android and selecting my targeting API level then cleaning the project resolved the issue for me.

johnw182
  • 1,349
  • 1
  • 16
  • 22
0

in my case, i solved this problem as such: 1.Project->Properties->Android. Then, at the right, at Library space, see if there is any element. REMOVE it.

I had used an uncompatible GridLayout. THAT was the problem. I removed it and everything is fine.

tas
  • 1
0

the problem could be that some file has updated idk - to solve this problem for external libraries one must do the following

1 eliminate external library in eclipse via right click on the folder of the library and delete

then in your project do the following

  1. right click on the project and go to properties
  2. Select Java Build Path
  3. go to the Libraries tab
  4. Remove the jar file references which you have removed already. There will be a red mark near them so you can identify them easily.

and to add libraries you can do as follows

  1. Right click on the project
  2. properties
  3. android tab 4 at the end add
  4. search the library
  5. apply
  6. ok
Shawn Mehan
  • 4,513
  • 9
  • 31
  • 51
fabian
  • 1
  • 1