Android from scratch

January 18, 2010

Attaching Android platform source in Eclipse

Are you tired of seeing this when you look at your platform JAR in Eclipse?

Dude, where's my source?

(more…)

December 30, 2009

Editing XML resources for Android in Eclipse

Just the other day, I was griping about the way Eclipse ADT tools dump out XML in long unreadable lines like this:

As with so many things, Eclipse is your friend if you just know how to set it up. As it turns out, Artem Russakovskii of Beer Planet recently wrote an excellent post with instructions for configuring Eclipse to auto-format your XML pleasingly so it will look more like this:

I can do no better than to refer you to the post. In case he moves it or something, the short-and-sweet version is:

  1. Window -> Preferences -> XML -> XML Files -> Editor
  2. Source -> Cleanup Document

Making your XML readable means it’s also a lot more writeable. The ADT GUIs for working with resources are very handy, and you might not think you want to write XML by hand, but Eclipse is your friend here, too: it will suggest and auto-complete tags and attributes for you.

Eclipse can suggest and auto-complete allowed tags, attributes, and values for attributes based on the XML schemas supplied by the SDK. If Eclipse isn’t automatically suggesting (or like me, you’ve turned off auto-suggestions because they’re annoying), you can just press Ctrl-Space with your cursor placed where you’d like a suggestion in the document, use the arrow keys to choose a suggestion, and hit Enter to accept one. As you can see above, the suggestions come with at least minimal descriptions to jog your memory. This makes writing XML “by hand” almost completely painless.

December 14, 2009

The Eclipse ADT plugin for creating projects says I need to choose a target, but there’s nowhere to choose a target!

Filed under: ADT plugin, Eclipse, SDK level 2.0.1, n00b frustrations — Tags: , , , , — luke @ 9:03 am

This was a particularly frustrating one, but it’s really simple to resolve.

Creating a project - how do I specify the build target when none is listed???

Creating a project - how do I specify the build target when none is listed???

This is a simple problem of screen real estate. When the dialog is not long enough vertically, the part that is shrunk (down to nothing!) to fit is the Build Target selection box. The only way to get it to show up is to expand the dialog vertically – you may have to increase your screen resolution to fit it all in (I found this out while working on an Eee PC – a screen height of 600 pixels won’t cut it!).

For completeness, I should probably mention that your SDK comes with no build targets – you have to download some after unzipping it. But if that’s your problem, you should still see a white space in the Build Target selection box where the targets would be.

This is a pretty strange design problem. Seems to me it would make more sense to occlude the bottom of the dialog in this situation rather than something essential in the middle. Or just put a scrollbar on the dialog!? I found a few other people complaining about this problem.

December 7, 2009

Missing dependencies for the Eclipse ADT plugin

Filed under: ADT plugin, Eclipse, SDK level 2.0, n00b frustrations — luke @ 7:26 am

When installing the plugin, depending on your setup, Eclipse may fail with a message that dependencies are missing.

com.android.ide.eclipse.adt.feature.group requires org.eclipse.wst.xml.ui 0.0.0 but it could not be found

com.android.ide.eclipse.adt.feature.group requires 'org.eclipse.wst.xml.ui 0.0.0' but it could not be found

Unless your Eclipse is too old (the plugin requires 3.4 or above) this is not really a problem with Eclipse, the SDK, or ADT, but rather how various operating systems package Eclipse. The appropriate components need to be installed or Eclipse needs to be configured with the appropriate software update site for its version so that it can resolve dependencies for you. (more…)

Powered by WordPress