Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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

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

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.

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top