Question

I have a working app that I've now converted to being a library project in Eclipse. When I attempt to include the library as a "Project Reference" in an empty app (no other functionality other than what it inherits from the library) it fails to build. I get the message Unable to execute dex: Multiple dex files define Lcom/facebook/android/R$attr;.

To try to work around this I tried to delete the Android Dependencies completely. But then I get a "Class not found exception" for classes in the library.

Is it possible to remove the Facebook dependency without also removing the app library dependency? I tried to delete the facebooksdk.jar file but was unable to do so since all the buttons are grayed out. (see screen capture below)

attempt to delete facebooksdk.jar

I also tried simply unchecking "Android Dependencies" in "Order and Export". That had no effect on the problem.

Your suggestions are welcome.


FYI, my project has 3 main components. All 3 are contained in the same Eclipse project folder (see screen capture):

Eclipse project view

  • Application "App_A"
  • Library_L (included as Project Reference in "A") It's worth noting that Library_L executes perfectly when I run it as a non-library project.
  • Facebook SDK 3.0.2 (included as Project Reference in Library_L (see screen capture) Library's Project References
Was it helpful?

Solution

Project References are used to include a library project (e.g., the Facebook SDK).

The documentation -- and books by balding guys -- show you how to attach an Android library project to your app, and it has nothing to do with "Project References".

Similarly, the documentation for the Facebook SDK shows you how to attach their Android library project to your app (see Step 6). They follow the standard Android library project approach, and that too does not involve "Project References".

Now, it is conceivable that there's something about a newer Eclipse version (I'm running Indigo) that causes "Project References" to show Android library projects as checked -- it does not do so in my version.

Make sure that you have properly set up the Android library projects, and see if that helps with your issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top