Facebook + Google Play Services + Unable to execute dex: Multiple dex files define Lorg/cocos2dx/lib/Cocos2dxAccelerometer

Hi,
I have a project in 2.0.3 and since I am using cocos-builder(version 2.1), I cannot port it to the latest version of cocos2dx. I get the error
Unable to execute dex: Multiple dex files define Lorg/cocos2dx/lib/Cocos2dxAccelerometer

when I try to run the project. I know that to get rid of this error, we have to delete the Android dependencies under Build Path. But the problem that arises that when I delete this is that Google Analytics and facebook, both stop working,as they are also added as referenced projects. Anyone got a fix for this?

Bump! No one has the same issue?

Hello,

Multiple dex file error occurs when you have a compiled .class available from more than one lib or .jar file. To fix the issue make sure that the same class files are not being imported from more than one place.

For eg. there is a pretty high chance that your android support library (v13 or v4) is being imported from one than once place. Fix that issue :smile:

Best of luck

As happybirthday indicated there are duplicate classes on the classpath. I got the exact same error as you did. I went to Properties -> Android and removed the libcocos2d library reference and then the errors went away. This is because it is also referenced as an external source in the java build path.