Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
808 views
in Technique[技术] by (71.8m points)

android - Why Can't Google's Market Billing Sample Build in a Signed Release Version?

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 com.example to com.billtheape.

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:

  1. Exited Eclipse
  2. Spotted three subdirectories under %ANDROID_HOME%extrasgooglemarket_billinggencom: (1) android (2) example (3) billtheape
  3. Deleted the subdirectory example.
  4. 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...