Sunday, August 22, 2010

Hello World

With everything installed, time to try a tutorial.  The first one on the Android site Hello World has a fair number of steps because it covers creating an Android Virtual Device (AVD), two different ways of doing UI, and a first look at debugging.  Everything worked just as expected when I tried it.

When you create an Android project, one of the fields is "Min SDK Version".  The tutorial doesn't have you fill it in, and that's OK.  When you run the app, you will get a complaint but nothing bad beyond that seems to happen.  If you do want to fill it in, for example if you want to require Android 2.2, you need to specify 8, the API version, rather than 2.2 as you might expect.

The emulator is sooo slow to load.  For me, it takes about 1 minute and 45 seconds, and my Mac runs at 2.8GHz with 8 cores.  In the emulator window, first I see a black screen with "A N D R O I D" in the middle, looking like that, a normal font.  After a while it switches to "android" in a fancy font, chrome colored with light sweeping across it.  After another while I get the home screen, which has a nice picture of a lake as the background.  Then finally the app runs.

If you don't already know how to do debugging in Eclipse, this tutorial is no help.  You set a breakpoint and can stop on it, but then what?  It's certainly not obvious.  And if I step until the bug happens, it's even more mysterious because my code that has the bug doesn't appear to be on the stack.

BTW, when the debugging stuff is up, you are in a different Eclipse perspective from where you were before.  To get back to seeing your project you can click in the very upper right of the window to bring up the Java perpective or you can do it via menus: Window --> Open Perspective --> Java.

No comments:

Post a Comment