Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to execute dex: Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1;

I have an android app, which calls an jar lib say b.jar. This b.jar lib. is then calls facebook sdk lib. When I compile my app under this situation, it always says

Unable to execute dex: Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1; Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1;

I have used a few days to make it work, however, I failed to tackle this issue. Do anyone know how to solve this issue?

like image 293
Jacky Lam Avatar asked Mar 29 '13 18:03

Jacky Lam


2 Answers

Go to the project properties and then Java build path -> Libraries -> Remove Android dependencies and OK then Run your project

Referred from : https://stackoverflow.com/a/15247670/1585773

Worked perfectly for me .

like image 86
May Avatar answered Oct 01 '22 15:10

May


All answers are a work around. They do not solve the root cause of the issue. If you look at your project structure, there is a FacebookSDK project and your Project. In both the project, you have com.facebook.android(first java file being AsyncFacebookRunner) package, which have the same java files included. Obviously multiple dex files will define your class files and you will get error.

Solution - Remove the com.facebook.android from you main project (not FacebookSDK).

like image 20
Sandeep Taneja Avatar answered Oct 01 '22 15:10

Sandeep Taneja