views:

40

answers:

2

Sorry I am new, stackoverflow does not allow me to post image and links...

I try to use Official Android SDK (http://github.com/facebook/facebook-android-sdk/). I install the SDK and try to run the Example

At first, it fails at "build", it cannot find the Facebook SDK, so I try to follow the steps found in SDK page:

Add a dependency on the Facebook Android SDK library on your application:

  1. from the File menu, select "Properties"
  2. once the project Properties are displayed, open the Android section, which should list the build targets and libraries
  3. in the bottom "Library" section, click "Add..." and select the Facebook SDK project
  4. refer to http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject for more details

I check the link at #4, it shows a Mac OS X version Eclipse, which has Library section, but on my Vista PC, with Eclipse 3.5.2, it does not have Library section...

-http://developer.android.com/images/developing/adt-props-isLib.png

-http://farm5.static.flickr.com/4138/4852346022_fc8f6bedbe_b.jpg

I try to add the Facebook SDK in Java Build Path. Now it can "build" and start, on both Emulator and Device. However, once it started, it crash, the logcat shows:

ERROR/AndroidRuntime(518): java.lang.NoClassDefFoundError: com.facebook.android.Util

-http://farm5.static.flickr.com/4138/4852346048_f4a3b998a3_b.jpg)

I searched around, about "NoClassDefFoundError" program, but seems those solution is solving external JARs files. I have no problem adding other JARs files, and this Facebook SDK is not JAR...

I tried Clean, rebuild, delete everything and config again, but can't solve this problem yet.

Anyone have idea please help, Thanks.

A: 

This exception is thrown if a class could not be found at runtime even if it was available when the program was compiled. You need to double check that the SDK jars are available to then program in the launch configuration. This includes the jars being physically present ón the device.

Thorbjørn Ravn Andersen
Thx. At the end, I solved this using the following method. I import the SDK to eclipse (follow FB instruction), then I export it as a .jar file. Then I add this .jar file to my project. It works now.
Leonardo Wong
A: 

I have the same problem. did not found any solutions. anybody can help more ?

Fabien