Android class “already added” when building

Posted by admin on Mar 22, 2012 in Uncategorized

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 com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[dx] at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[dx] at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[dx] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[dx] at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[dx] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[dx] at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:206)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:174)
[dx] at com.android.dx.command.Main.main(Main.java:95)
[dx] 1 error; aborting
Upon inspection, it appeared that there were multiple R.java 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

Posted by admin on Jul 12, 2011 in Uncategorized

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

Posted by admin on Jul 15, 2010 in Rails, Uncategorized

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.


Two People I Wish Were Still Here

Posted by admin on Oct 15, 2009 in Uncategorized

For whatever reason, I was thinking it sure would be an interesting world if Diana Spencer and John Lennon were still among us.


My Three Thank Yous

Posted by admin on May 11, 2009 in Uncategorized

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

Posted by admin on May 11, 2009 in Uncategorized

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

Posted by admin on Dec 4, 2008 in Uncategorized

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


New Blog Location

Posted by admin on Nov 30, 2008 in BMW, Business, iPod / iPhone, Java, Mac OS X, nginx, Rails, Ruby, Testing, TextMate, Uncategorized, Unix, Xcode

I finally made an honest blog out of this thing.



Posted by admin on Jun 5, 2008 in Uncategorized

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 icanhascheezburger.com 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

Posted by admin on May 28, 2008 in Uncategorized

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

Copyright © 2017 Standalone Code LLC All rights reserved. Theme by Laptop Geek.