I tried looking into similar problems, but the solutions offered there do not seem to fit my particular situation:
I initially followed the instructions for Configuring and building the sample application for In-app Billing, replacing the security key with the public key from Google’s Developer account and changing the package name from
I then built a non-release version and ran a “sanity check” on my Android phone. Everything went OK (except for accessing the Android Market server, of course, since by design it only works with a signed release version).
Then I tried to build a signed release version, but received the error:
[2012-01-03 20:52:45 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/android/vending/billing/IMarketBillingService; [2012-01-03 20:52:45 - Dungeons] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/android/vending/billing/IMarketBillingService;
The problem now is that even the “debug version” building generated the same error, regardless of how many times I tried to clean the project.
This didn’t look to me like a Build Path issue in the sense that the accepted answer described (I checked that, too, but couldn’t find anything suspicious). So I tried something else:
- Exited Eclipse
- Spotted three subdirectories under
%ANDROID_HOME%\extras\google\market_billing\gen\com: (1) android
(2) example (3) billtheape
- Deleted the subdirectory
- Started Eclipse and cleaned the project.
Debug version builds now properly, but signed release still generates the same error. It turns out that deleting that extraneous subdirectory wasn’t what did the magic, but rather restarting Eclipse and then cleaning the project.
OK, so at least I got the “debug version” working back, but the signed release Export keeps failing with the same error.
Any idea what this error means, why it happens and how to fix it?
Short answer: Because Eclipse + ADT sucks. That’s why.
Longer answer: I just imported the same exact project to a different machine with a slightly different configuration: Eclipse 3.6.2 (instead of 3.6.1 in the problematic system described above) and SDK R13 (instead of R9 in the problematic system).
Then I tried to export it, using the same exact steps described above. Works like a charm!
What is this? Voodoo?
What happened to the days in which the IDE behaved more predictably than the software I was trying to develop?
Next step: Upgrade Eclipse (to 3.6.2) only, on the problematic system and see whether this solves the problem in that system, too.
Update: I just finished updating Eclipse 3.6.1 to 3.6.2 on the offending system. It turns out that it is impossible to install Eclipse and keep the existing ADT. https://dl-ssl.google.com/android/eclipse/ forces you to install “the latest & greatest” even if you want otherwise (for configuration management & tracking reasons for example). So with the new
Eclipse 3.6.2 I got
ADT 16.0.0.v201112150204-238534 as well. Works like a charm!
The root cause and explanation for the odd behavior of the combination
Eclipse 3.6.1 + ADT 9.0.1.v201101191456-93220 will never be known… and this is a combo with which developers were supposed to (and did) release commercial grade apps to the Android Market at some point in time. Amazing.
I too had the same issue and i solved it by :
- Delete bin & gen folder
- Remove the dependency libraries(if any) and add them back
- Finally clean up the project and build it again.