com.android.dx.util.DexException: Multiple dex files define

半城伤御伤魂 提交于 2019-12-10 12:34:42

问题


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:

  • Reinstall android sdk to other dir
  • Remove bin/gen dirs and clean project
  • Remove and add libs in eclipse
  • Change android API from 17 to 10
  • Make sure my bin folder is not included in my build path

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

Thanks for answers!


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/15869893/com-android-dx-util-dexexception-multiple-dex-files-define

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!