Android Draw 9-patch seems broken too

As far as I can tell, the current release of the Android SDK (R08) ships without the Swing Desktop jar, and this causes draw9patch to fail.
~$ draw9patch &

[2] 52452
~$ Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

[2]+ Done draw9patch

The ‘fix’ is rather simple: just download the JAR for Swing Desktop from here, and drop the swinglabs-0.8.0.jar file into the [sdk-install-dir]/tools/lib folder.
The Swing Desktop project can be found here.

Update — Richard just left a comment here and pointed me to his site (Android 9 Patch) who’s got plenty of 9-patch icons that really look awesome, and I thought I’d share the goodness (especially, given he’s so kind as to share them at no charge). 

Go check out Patch 15, it’s pretty impressive!

11 responses to “Android Draw 9-patch seems broken too”

  1. Thanks! It was very annoying.

  2. Thank you………..

  3. Thanks Marco!!! 🙂 Life saver (though I didn't use it in the end but I hate to see things break for no reason).Hope you don't mind, I posted your solution to another guy suffering from the same pain . I also added your solution as part of one of my blog entries (with backlink to you). If you don't like it, pls email me at my gmail acc.

  4. I have some graphics that can be use by your users for their test and various android projects here: are all free to use including for commercial apps.Enjoy!Richard Lalancette

  5. Hey Richard — that's really cool stuff!I'll update my post later to point the main text to your site (and, I can already see I'll use some of your stuff on my Android Receipts LoL )Thanks for sharing!

  6. Great Marco!Glad it's coming to be used.I'll have more 9-patch sometime this weekend.Writting the app was taking too much of my time 🙂

  7. Marco,There are now 500+ free 9-patch images ready!!!I have finally managed to complete the android browser you can find here: to come soon!Cheers!

  8. In case people bang their heads on why 9-patches don't work, I found out that they all need to be in one directory drawable-xhdpi. Even if there are other .9.png files that you don't use at all, in any other directory, they won't work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: