I’m trying to build an application using the facebook-android-sdk. I’ve pulled the sdk off github and imported the project into eclipse (under com_android_facebook). From there, I’ve added com_android_facebook to the build path of my project library. Looks like this:
main_project
|
+---shared_project_library ([x] Is Library)
|
| ^
| | project added to build path properties of 'shared_project_library'
| .
+---com_facebook_android
v src
v [+] com.facebook.android
> AsyncFacebookRunner.java
> DialogError.java
> ...
My main project is actually loading the shared_project_library as a library itself. Because I will have other projects based off shared_project_library, I’ve added the com_facebook_android project (imported facebook-sdk) at that level. Is it valid to pile up libraries on top of shared libraries like this? Might be my problem.
Things compile fine but when I go to run it, Dalvik cannot find the com.facebook.android.Facebook method. It’s like the application only knows about com_facebook_android at compile time, but not run-time. Any ideas what’s wrong? I’ve also tried exporting the com_android_facebook project as a Java JAR and including it under the “Libraries” section of the shared_project_library but still no luck.
dalvikvm E Could not find class 'com.facebook.android.Facebook', referenced from method com.lib.shared.myShare_fbook.<init>
PS: I’ve added the myShare_fbook to the AndroidManifest Activity permissions (of main_project), as well as added INTERNET permissions (per facebook sdk instructions)
I had the JAR and com_facebook_android included in the shared_project_library properties. I removed the JAR and left the com_facebook_android reference in under Android > Library and it’s working fine now. To verify I created a quick test project and tried to use the JAR, and got the errors below so guess this one was my fault.