6

I've been tearing my hair out over this one, for the past 3 hours I've been trying to fix it but have been unable to. I've created an android app and I'm ready to put it on the android market but I get this error when trying to export to an apk.

Unable to execute dex: Multiple dex files define Lcom/google/ads/Ad;

I've read a bunch on the problem and tried quite a few solutions but nothing has seemed to help. I've cleaned and rebuilt, I've delete the bin folder, I've made sure that the bin folder is excluded build path. Nothing's worked. If anyone could help me I would really appreciate it.

Stratus
  • 373
  • 1
  • 4
  • 9

6 Answers6

9

Untick the admob jar file in the "order and export" part of the "configure build path".

Matt
  • 91
  • 1
  • 1
  • Matt's response of "Untick the admob jar file in the "order and export" part of the "configure build path". " worked perfectly. While following the directions in the admob setup I followed the instructions here https://developers.google.com/mobile-ads-sdk/docs/ It notes the box as being checked in the screen capture provided, yet when I unchecked it everything works including the ads and all errors are gone. – user2084337 Feb 18 '13 at 18:18
  • It wasnt that I unticked mine it is that instead I had looked up the another admobs jar instead of the one in that apps libs folder. – mr.j05hua Oct 14 '13 at 03:16
5

On another post with a problem similar to yours the only thing mentioned that you have not already considered was updating Eclipse. I don't know how or what order that you have done these "fixes" but another poster mentioned that all at once he deleted the bin directory for his project, cleaned and rebuilt the project and restarted Eclipse. After that the error disappeared.

Good Luck- Lijap

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Lijap
  • 625
  • 3
  • 7
  • 23
  • That's what I ended up doing, uninstalling/reinstalling everything. – Stratus Dec 31 '11 at 21:27
  • Thanks for accepting my answer! Hope your app sells well too. – Lijap Dec 31 '11 at 23:38
  • 1
    @Lijap Why does this sound (and feel) like Voodoo? I am leery about updating a perfectly working Eclipse when the problem only exists in one application: Google's [market billing sample](http://stackoverflow.com/questions/8721498/multiple-dex-files-define-lcom-android-vending-billing-imarketbillingservice). Any tip or insight that can help me **understand** why this problem is happening and what it means would be greatly appreciated. +1 in the meanwhile... – Bill The Ape Jan 04 '12 at 18:04
  • I am not sure while this problem is occouring. Maybe it has something to do with conflicting dependencies from googles ad program and eclipse or the ADT. Some of the other sample applications on the official developer site have errors too, some are just not updated fast enough.I hope google will figure something out soon. Thank you! – Lijap Jan 08 '12 at 15:41
1

For me the error was due to 2 different versions of AdMob SDK being included accidentally. Removing one of them fixed it.

tarkeshwar
  • 4,105
  • 4
  • 29
  • 35
1

As other have noted, this problem should be due to multiple versions of Goodle's ad SDK classes being included in the app build. What I haven't seen yet is a note that the most recent Google Play Service lib includes classes that (at least) share the same names as some in the admob sdk-- for example, I came upon this error because I was trying to build with both admob sdk v.4.0.4 and the google-play-services_lib project as a referenced project; the latter contains google-play-services.jar which contains the package com.google.ads and many of the same classes as the admob sdk. Thus it appears that the google play services lib and the admob sdk cannot both be used in a given app. My solution was to remove the admob sdk entirely from the build.

CCJ
  • 1,619
  • 26
  • 41
0

I had the same or a similar problem. My problem was that my application imported a library which used a different version of AdMob SDK.

Details of my problem:

  • Library used AdMob SDK 6.3.0
  • Application used AdMob SDK 6.1.0

Fixed it by including the same version.

marnaish
  • 2,266
  • 1
  • 21
  • 17
0

For me, I just have to take out the libs folder which contains android-support-v4.jar from build path and it worked.