15
Dec
image

We, Android developers, spend our days staring at a computer screen, most likely at one of Eclipse's windows. Eclipse is an amazing IDE in theory, but it never quite feels complete and polished, mostly due to the fact that it's powered by open source enthusiasts and is based almost entirely on plugins (if you want to get it to do anything useful, that is).

Being Android developers, the plugin we are using every day is ADT - Android Development Tools, written by Google engineers, mostly @tornorbye and @droidxav who I've been conversing over twitter lately and annoying with filing numerous ADT bugs (hi, if you're reading!). ADT isn't quite perfect yet, but these guys are trying their best to perfect it every day. The culmination of their latest efforts was the release of ADT 8.0.0 last week, timed to come out at the same time as the Gingerbread SDK.

Version 8.0.0 introduced the new Layout Editor and fixed numerous bugs, among other things, but more bugs remained and more features were left desired. Are we to wait for Honeycomb or something even more distant for the next version of ADT? No way - I've been filing bugs left and right, saw some of them get fixed in days, and now want to use a version of ADT without them, while enjoying all the new stuff that gets added every day.

Are you a hardcore developer with interest in the bleeding edge developments in the Android Development Tools? Add this ADT commitlog RSS feed to your reader and enjoy seeing those bugs getting squashed.

Rather than have us wait for months, the ADT dev team decided to start maintaining a bleeding edge, easily installable, hassle free package corresponding to a working ADT repository trunk. Sure, you can build ADT from source, but it's not a task every app developer would want to perform, plus you never know whether the trunk is in a good state or not. So, rather than wait for the next version to be released, just download and install it yourself - the whole process takes about 1 minute.

What's New In ADT 9.0.0-preview1?

The current version of ADT up on the download site is 9.0.0-preview1, which corresponds to the latest working trunk. The changes include, among other things, some of the bugs I've reported only this week, and it is especially awesome to be able to see the results so soon. I just love open source.

Looking at the changelist below, I'm mostly excited about the R.foo stuff I highlighted below. All I can say is, "finally!"

Changes since release 8.0.0:

  • Many bug fixes.
    • Of particular note, the launch feature in Eclipse will now properly work when the target device is running a production build. It will not complain that debuggable=true is missing from the Android Manifest anymore, since the build system inserts it automatically.
  • Go To Declaration hyperlink support: You can jump directly from code references such as "R.id.main" in Java code right into the corresponding XML declaration, as well as from XML attributes (like @string/name) to the corresponding resource definition, and from manifest XML registrations to activities and services, etc.
  • Improved support for empty and nested layouts. Dragging over nested and invisible layouts automatically enlarges and highlights these layouts such that they can receive drops.
  • Support for rendering targets. You can now choose an arbitrary Android platform to have the current page rendered with, regardless of the minimum platform chosen by the project. This makes it easy to check pages visually for different platforms.
  • XML formatting improvements: The XML edited by the tool should be much cleaner, and you can enable auto-formatting in the options.
  • Automatic configuration for various view types. As an example, you now automatically get match_parent width filling when you drop say an EditText into a vertical LinearLayout, you get a default image added to ImageButtons, etc.
  • Dragging from the palette, and dragging within the layout editor, now shows live previews of the dragged item rather than just a simple drag & drop cursor.
  • Improvements to the support for rename refactoring.
  • In the layout editor, double click views to warp to the corresponding XML element, and in the outline view, a double click will open the properties view.

Here are more details on the Go To Declaration hyperlink support:

  • In your Java code, if you see a symbol like R.id.button1, you can click on this to jump right to the layout definition of the view which defines id button1 (@+id/button1).
  • In the R file, you can jump right from "public static final int Button01=0x7f050000" to the corresponding button definition
  • In your Manifest file, you can jump from an activity definition (or service definition), such as <activity android:name=".TestActivity", right into the corresponding Java class
  • You can jump to any value definition (e.g. @string:foo), regardless of which XML file "foo" is defined in
  • In addition to values you can also jump to all the file-based declarations (e.g. @layout/bar)
  • You can jump to non-XML resources as well, such as @drawable/icon. This will launch whatever Eclipse opening mechanism exists for the given file type, in this case an image.
  • You can jump into @android namespace resources. This will open the resources found in the SDK install area.
  • From XML layouts, you can jump to custom view classes (e.g. <foo.bar.MyView></foo.bar.MyView> ), or  <view class="foo.bar.MyView")

We can finally have XML auto-formatted when edited by the Layout Edit/or! Wooo (it's not exactly what I thought it would be, but I'll settle for this too):

image

If you're interested in following the latest developments in bite-sized human-readable pieces, I highly recommend subscribing to the Android Tools blog.

Download/Install

Downloading and installing the latest ADT plugin is easy as pie:

  1. Download the latest release from this page (currently 9.0.0-preview1)
  2. Go to Eclipse > Help > Install New Software...
    image
  3. Click Add...
    image
  4. Click Archive... and select the zip you just downloaded
    image
  5. Give it a name, say ADT-9.0.0-preview1 and press OK
    image
  6. Follow the prompts, restart Eclipse, and voila - you are now running the latest and greatest (though, with some potential bugs)

And that's all, folks - enjoy! Thank you to the ADT team, specifically Tor and Xavier, for putting this together and maintaining the tools - you guys rock!

Source: @droidxav, @tornorbye

Artem Russakovskii
Artem is a die-hard Android fan, passionate tech blogger, obsessive-compulsive editor, bug hunting programmer, and the founder of Android Police.
Most of the time, you will find Artem either hacking away at code or thinking of the next 15 blog posts.

  • http://tornorbye.blogspot.com/ Tor Norbye

    Hi Artem, thank you for the kind words! I just want to point that that there is a third engineer, Raphael, who has been doing a huge amount of work (he had written most of the new layout editor before I even joined Google a few months ago!) - he's just not public on Twitter like Xav and me. But if you look in the commit logs you'll see his name a lot!

  • http://tornorbye.blogspot.com/ Tor Norbye

    Regarding your twitter question on Java hyperlinks -- it's hard to follow up when limited to 140 characters on twitter so let me try here:

    Note that in Eclipse there can be -multiple- hyperlinks. For example, you'll often get a popup which asks you if you want to jump to the Declaration or to the Implementation. Each of these is coming from a separate hyperlink detector. For Android, we have our own, and it offers to take you to the "XML Declaration".

    SO, if you're in some class like an Activity, and it's referencing "R.id.main", you should be able to ctrl-drag over "main" (not the "R" or "id" tokens), and it should ask you if you want to go to its Declaration (that's the standard Eclipse hyperlink, which will take you into the R file), or the "XML Declaration" -- THAT's the one you want to choose. There isn't (as far as I can tell) a way for me to customize or override the builtin Declaration chooser, and at least in the above scenario, you could plausibly want to go to either place...

    Our hyperlink detector is actually registered twice, once as used above, and a second time using modifier keys 1 and 2. This means that you should be able to -directy- choose XML declaration by pressing not only Control but the second modifier key too -- I'm not sure if that's Alt or Shift on Windows, so try both -- e.g. Ctrl+Shift+Drag click or Ctrl+Alt+Drag click and see if that takes you directly to the XML declaration rather than popping up a hyperlink chooser popup!

    • http://www.AndroidPolice.com Artem Russakovskii

      Tor, indeed, now I see what you're talking about. I replied on Twitter a few times before seeing this, and I see you're saying it's not possible to hook into the "Open XML Declaration." :(

      What if you just override Open Declaration for those cases instead? Who ever wants to actually go to R.java? I bet in 99.9% of the cases, you want to go to XML.

Quantcast