4

I've installed the Facebook API for Android in Eclipse, and imported the project into my Android project. My program builds perfectly fine, but when I try to run it I get

Could not find com_facebook_android.apk!

in the build window, and when the program actually tries to import any of the Facebook API classes it blows up with a java.lang.NoClassDefFoundError: com.facebook.android.Facebook

phwd
  • 19,975
  • 5
  • 50
  • 78
Chris B.
  • 85,731
  • 25
  • 98
  • 139

6 Answers6

5

Probably you added the reference to the Java project in the "Java Build Path" but it's the wrong place.

From the Android guide:

To add a reference to a library project, follow these steps:

  • In the Package Explorer, right-click the dependent project and select Properties.
  • In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
  • Click Add to open the Project Selection dialog.
  • From the list of available library projects, select a project and click OK.
  • When the dialog closes, click Apply in the Properties window.
  • Click OK to close the Properties window

This resolved my problem.

Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
alessio
  • 51
  • 1
  • 1
2

In my case helped, not to have in the referenced projects checked Is Library

(Project Properties > Android)

sample image with "Is Library" unchecked

Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
2
  1. Check out referencing libraries instructions here:
    http://developer.android.com/guide/developing/projects/projects-eclipse.html

  2. Make sure you have the latest versions of ADT.

  3. Try to clean your project in eclipse.

Hope this helps

phwd
  • 19,975
  • 5
  • 50
  • 78
Anatoly Lubarsky
  • 3,026
  • 1
  • 18
  • 16
1

I am also having issues with this error and have noted that if I run eclipse as root then the error disappears. This makes me think it is a permissions issue

So to help:

On the com Facebook android project right click > android tool > build and export

Then simply build the project into the bin folder of the Facebook project.

Problem solved

paul
  • 11
  • 2
0

I had a similar problem. This was my resolution. I had to add android.jar as a reference.

Android samples error

Community
  • 1
  • 1
Sean Dunford
  • 938
  • 1
  • 9
  • 24
0

If nothing works, try deleting the Facebook application for Android (if you have one installed on your phone). This worked for me.

Rayhunter
  • 243
  • 3
  • 9