1

I am following Getting Started with the Facebook SDK for Android, at step 6, the FacebookSDK needs to be linked to my Android Project. However I get some unknown error and I'm unable to get details as to why or how to fix it.

I reference the Facebook SDK as follows:

enter image description here

However when I run the application, the console displays a message stating the FacebookSDK.apk cannot be found. And my application throws a class not found exception.

Upon inspecting the project setup I found this:

enter image description here

I don't have much experience with linking projects. I don't know what the red error means, also the project is marked with a question mark.

I have done and checked the following with no luck: - The FacebookSDK is part of my workspace. (I can compile the sample projects)

  • Cleaned and rebuilt the workspace.

  • Recreated the workspace and repeated the entire process.

  • Included FacebookSDK.jar in my project's bin directory.

  • The FacebookSDK file were not copied to my workspace, I only referenced it as per the Getting started guide.

blaffie
  • 505
  • 1
  • 10
  • 32

3 Answers3

0

So I'm still not sure what caused the problem but I found a workaround after trying several steps without any luck:

  • Created new workspace
  • Changed target built to be Android 2.2 (Froyo), the same as the built for the Facebook SDK
  • Rebuilt Project
  • Clean Project

I carried on with the tutorial and added the imports such as

import com.facebook.*;
import com.facebook.model.*;

Eclipse then suggested an auto-fix, to add the FacebookSDK to the build path of my application. The FacebookSDK project was part of the same workspace.

EDIT: This did solve the problem of the IDE not recognizing the classes in the FacebookSDK, however when I try to run, the FacebookSDK.apk is not found. This is because I referenced the SDK as a project when it should be a library. I'm not sure how to fix.

FIX: Copy the FacebookSDK project files into the workspace and build all projects.

blaffie
  • 505
  • 1
  • 10
  • 32
0

I had the same problem after days and I couldn't find a answer, so after trying many things I resolved my issue by downloading another Eclipse, installing "ADT plugin", changing the workspace and importing it again

You can see here for how to download another Eclipse and install ADT

After all that, open Eclipse and choose another workspace (I just worskpace2) and import the FaceBook SDK and the other projects

Zach Saucier
  • 24,871
  • 12
  • 85
  • 147
0

First import Your FacebookSDK Project in your current Project Explorer of eclipse to do so follow the procedure

  1. Copy your facebook-android-sdk-3.0.1 in your workspace

  2. File >> Import >> general >> existing projects into workspace

  3. select rood directory to your workspace and select facebook-android-sdk-3.0.1

  4. click on your FacebookSDK and click ok

  5. Right Click on project and Properties >> android >> ADD >> FacebookSDK click apply and ok

You have done..

Prem
  • 49
  • 8