Android class “already added” when building

I am working on an Android project constructed of:

  • The main app (very lightweight wrapper + AndroidManifest.xml)
  • The main library (where all the real work gets done)
  • Facebook-android-sdk
  • HockeySDK-Android

Recently, I started seeing the following error when building the app using ant:

[dx] java.lang.IllegalArgumentException: already added: Lcom/facebook/android/R$anim;
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at$400(
[dx] at$1.processFileBytes(
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] at
[dx] 1 error; aborting
Upon inspection, it appeared that there were multiple files per module with different package names but the same content. Removing all the “gen” directories in the entire project resulted in a successful from the command line.

It’s the mistakes that crack me up

When I was working on ResEdit for Apple back in the mid-90s, I made a mathematical mistake that caused resizing to be geometric instead of linear. Man, you could resize a control very quickly that way! Anyway, today’s mathematical mistake wasn’t quite as serious, but still brought me a good chuckle.

Maybe I should make the circle fit *inside* the rectangle

Rails 3: Validation error display using HAML

Here’s what I am using at the top of the view I just converted to HAML in a Rails 3 app to display any validation errors. Adjust for your own model and preferences as desired.

%h2 New Form in HAML
= form_for(@new_model) do |f|
  - if @new_model.errors.any?
      %h2= "#{pluralize(@new_model.errors.count, "error")} prohibited this new_model from being saved:"
        - @new_model.errors.full_messages.each do |msg|
          %li= msg

Edit 16-July-2010: It turns out that Rails 3 has a template engine that you can use to generate the views for you using HAML when you scaffold up a resource. Watch Ryan Bates’ excellent Railscast Episode 216 for more information.

My Three Thank Yous

On the heels of Gregg Pollack’s call to action last week to give out three thank yous, here are mine:

  1. Thank you Uncle Bob Martin.  Adopting your three rules of TDD changed my development style and helps me to deliver excellent quality code and design.
  2. Thank you DHH and the Rails core team for providing a framework that truly delivers on the promise of allowing you to focus on the business logic of an application as opposed to the more pedestrian work (Java EE, are you listening?)
  3. Thank you Matz for Ruby.  You’ve taken an old (C/C++/Java) dog and learned him some (dynamic) new tricks.

RailsConf 2009 Thoughts

Some thoughts after spending several days immersed in the software development goodness known as RailsConf 2009:

  • Uncle Bob’s keynote was not only hysterical but extremely informative and motivational.
  • I enjoyed the various Cucumber talks and I believe I now know where to start with it.
  • Sometimes it helps to be “old” as I knew the significance of the zip code 02134 and won a copy of the Rspec book.  Send it to Zoom!
  • I’m downloading RubyMine and trying it out.  Gregg Pollack’s demo makes it appear extremely promising as a Ruby/Rails IDE.
  • “Code smells” was a new term for me.  Cool that metric_fu is available to sniff your code in many different ways.
  • I need to look into Webrat and Nanite.
  • I need to get a github account and put some of my code out there if I want to be like all the cool kids.
  • After working with git for several weeks on a daily basis, Scott Chacon’s advanced git tips and tricks really put git over the top for me.  And the cheat sheet should prove insanely useful.
  • I’ve known about the various Amazon Web Services for a long time now.  I should actually try them out.
  • The Las Vegas Hilton needs to be put out of its misery.

A New Paradigm for the Auto Industry

I was just discussing the merits of what is essentially a “just-in-time” delivery system for the iTunes App Store.  My question:  “Why can’t you do the same thing with the auto industry?”

Here’s my proposal:

– Dismantle all the dealerships

– Order your vehicle on-line.  Completely customizable.  Vehicle is delivered TO YOUR DOOR within 30 days of order/funding.

– Vehicle is fully refundable within 15 days of purchase (some restrictions apply)

– Hertz/Avis/etc provide an outlet for the manufacturers for people to test-drive the vehicles

– Independent mechanics are certified by manufacturers on an annual basis to service vehicles

– Parts purchasing is entirely on-line


I’ve always believed that when you boil everything down, everyone wants two basic things:

  1. To be listened to
  2. To be appreciated/recognized

Consequently, it really pisses me off how a large number of people simply fail to respond to emails which clearly require a response.  Sure, there are emails that don’t require a response, e. g. the latest lolcat at that I wanted to share.  But when I ask a question or send a meeting invitation, you would think that would elicit some sort of response, even if it is “Not no, HELL no.”  What do I get a lot of the time instead?  Crickets.  I mean, come on, do my emails smell bad or something?

And to those of you who do reply to my emails, I do really appreciate it.

Food for the Soul

After having spent what amounts to the most fun as well as most meaningful 4 days for me in a loooooong time over the weekend helping certify my kids as open water divers, I have made another resolution:

Once a week, I am going to do something that I really love doing for a couple of hours. Currently, that list contains:

  1. Shooting
  2. Flying
  3. Diving