So, I Wrote My First "Hello World" Android App...
Posted by
Brad Wood
Oct 07, 2009 04:04:00 UTC
My friend John dreams 3 or 4 get-rich schemes every week. Most of them involve technology, and he generally tries to talk me into helping him with them. He can never be dissuaded from the belief that each of his brainstorms are nothing short of an entrepreneurial pot of gold. These revelations, of course, come despite the fact that he has virtually no programming experience and even less start-up capital. Most of his recent ideas have all been centered around the new Google Android phones and the ability to write apps for them. After listening to him babble about Android app development for several weeks straight, I decided to download the Android SDK and play around with it.The Android SDK can be downloaded for free. Much like Flex, you can write your apps in notepad and compile them via a command line interface, but who would want to do that? Again, like Flex, an Eclipse plug-in has been built which interfaces with the SDK and emulator software to compile and run your apps.
I like how Adobe has made Flex Builder available as a stand-alone install. For Android development it appears you have to download three separate items. A Java version of Eclipse, the Android SDK, and the Android Eclipse plug-in which is pointed to your SDK location.
Your Android apps are written in Java. There are a collection of pre-built libraries that are used to generate views as well as interact with the phone's hardware. Every Android app must declare what data and functions of the phone it will access, and the user must accept those terms when they install it.
Layouts can be created in Java my creating instances of each of the display classes you want and appending them into the view object. What I found very interesting was the alternative XML-based layouts that you can create which are very reminiscent of MXML. In fact you can do some pretty cool lists and bind a select action with a very small amount of code.
Alas, I didn't make it very far with my Hello World app. Apparently you need a Cray supercomputer to run the darn emulator. Well, at least something faster than the 2.4 GHz Celeron I was trying to run it on. When I tried launch the app the first time (which involves compiling your app, launching the emulator, and deploying the app to the emulator) it pegged my CPU at 100% for two hours before finally throwing an error. The second time I left it overnight and when I awoke the CPU was still pegged and the emulator still hadn't finished booting. The last time I tried it, Eclipse refused to get past 27% compilation of the program. Did I mention the CPU was pegged the entire time? I promise I'll never complain about the compilation time of Flex apps again.
Maybe I'll get the chance to mess with this in the future with a more powerful machine, but I've grown weary battling it for now. What I really wish is Adobe would just get their Integrated Runtime (AIR) on all mobile phones and solve this once and for all. Then you really WOULD have to only write your apps once...
Russ S.
You left your CPU at 100% overnight? And it still works...?
Brad Wood
lol, of course it does-- I mean there IS a cooling fan on it! It's not overclocked or anything (hmm, maybe that would help) and I assume gateway took into consideration the maximum load when they specced out the heat sink and cooling fan. I'll call it the second burn-in.
I'm much more concerned that 2.4 GHz going full steam for hours is apparently NOT enough processing power to launch a cell phone emulator. Hello? Cell phones aren't that powerful yet. :)
Rick Mason
Stop playing around with Java. Instead use the PhoneGap library and write your apps in javascript and deploy them to Android, iPhone and Blackberry.
http://www.phonegap.com/
Brad Wood
@Rick: PhoneGap does sound cool. That's just the thing I was wishing existed so that you could write an app once for all phones. I'd rather get AIR on cell phones though since it already runs on any desktop.