12

I use ant release and got this error:

   [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
   [dx] com.android.dx.util.DexException: Multiple dex files define Lcom/android/vending/billing/IMarketBillingService;
   [dx]     at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:580)
   [dx]     at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:538)
   [dx]     at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:519)
   [dx]     at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
   [dx]     at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
   [dx]     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
   [dx]     at com.android.dx.command.dexer.Main.run(Main.java:232)
   [dx]     at com.android.dx.command.dexer.Main.main(Main.java:174)
   [dx]     at com.android.dx.command.Main.main(Main.java:91)

I have same error, but answers didn't help me

I tried:

I have 1 main project and 2 lib projects (Facebook and Expansion files downloader)

Thanks for answers!

Community
  • 1
  • 1
user2172670
  • 131
  • 2
  • 5

2 Answers2

8

Please check if the package includes com/android/vending/billing/IMarketBillingService is reference twice or more in your project settings.

Robin
  • 10,052
  • 6
  • 31
  • 52
6

This exception happens when two identical jars are imported to the projects. Android tries to build the dex file (this is the file where all the java jar's and classes are joined together) it's gets an exception.

The solution is to go though all the jars that you are importing to the project and remove the duplications. In this case Lcom.android.vending.billing.IMarketBillingService has been referenced more then once as written above.

oznus
  • 2,446
  • 2
  • 25
  • 18