A Voyage to Android-land on a dotNet Ship: Getting Started
This year, I've been writing about using Android phones to access Windows Azure Mobile Services (aka "WAMS") and was briefly writing about Service Bus Notification Hub. I've also done a lot of Server Scripting writing, and playing with Windows Store apps. Now I'm back writing more Android code.
So how has the journey to Android-land been for this dotNet developer?
I've been using the Android Eclipse IDE, which you can download from here. I am also considering using Android Studio: I will likely use Eclipse for my current coding, and then re-do it in Android Studio so I can compare the two. I have heard negative things about Eclipse, and perhaps the fact that there's an on-going replacement project lends credence, but for now I'm being charitable and assuming that most of the problems derive from my own lack of familiarity with Eclipse.
Here's my initial list of good and bad, coming from someone on a steep learning curve, and who "lives" inside Microsoft Visual Studio. This is based on Building Your First App, plus my experience writing several WAMS tutorials.
First the good:
- It works! This was my first stint at writing apps for any kind of phone, and I was amazed at how easy it was to get a "Hello World" app loaded onto my Android phone, as well as to run it in emulator mode. There was no hassle with any kind of App Store, I just coded it and loaded it onto my phone.
- Google's docs are generally pretty good.
- In Eclipse, I like being able to comment out code blocks automagically (and re-commenting them). I'd like to believe this feature is lurking somewhere inside Visual Studio too, but I haven't found it by looking around the VS menus. I probably need to do an internet search to verify this or not.
- I like Eclipse's Package Manager and the ability to click on methods and go to the definition code.
- From my limited standpoint, Android appears on the surface to be well architected and organized.
Now for the "bad stuff" (relatively: I was able to figure this out and nothing permanently blocked me):
- Downloading a USB driver for my Android phone was NOT a seamless process.
- Eclipse has a number of issues for me:
- The relationship between Workspaces and Projects is not clear. Is it analogous to Solutions and Projects in Visual Studio? When I see multiple projects in a Workspace, are they independent of each other, or considered to be pieces of a larger whole? When I am in one Project, I see errors that were generated in a different Project.
- Eclipse doesn't seem to update real time: I had an error in a layout, fixed it, and had to save the file for the error to go away.
- Perspectives are confusing: I used the Debug perspective, wasn't aware that I needed to switch back to the Java perspective (or even that by debugging I had changed perspectives). Somewhere in all of this the Emulator icon vanished off my tool bar. I was able to run the Emulator from the command line, and eventually figured out how to get the icon back.
- The Run command is kind of confusing: when you click it, it looks like nothing happens. I would like a message to tell me either to start up an emulator, or plug in my phone with a USB cable. Or at least some kind of error message. Having nothing happen is mysterious, and leaves it unclear whether it recompiled my latest changes, or what it did... Eventually, the Emulator started coming up consistently, but it was unclear what I did to cause this.
- Having to separately download Java is annoying, and it is confusing where the best path to put it is.
- Emulator issues:
- The best advice when it is starting up is to just WAIT, eventually things work out.
- But initially I had trouble getting the Emulator to update. I did the basic Hello World, then followed up with Building a Simple User Interface, and initially the Hello World app kept appearing in the emulator. But waiting worked, once I quit moving on to something else out of impatience...
- Getting Started with Data throws exceptions when run with my Emulator, but works fine when you connect an actual phone. This probably has something to do with the device that the Emulator is emulating, but the exceptions are pretty non-transparent. It would help if Google would recommend a "vanilla emulator" to use for tutorials.
I'm big on writing really clear tutorials for beginners, and know that this is much harder than it looks, largely because it is hard for an experienced person to put themselves back into the beginner's mind. Here, I'm lucky: I AM that beginner with Android. I find that approaching a new area with a blank mind is a great way to find shortcomings in documentation and UI, and uncover pitfalls that other beginners may fall into. Often when you know a subject deeply, you lose sight of all the assumptions, context, and implicit knowledge that a beginner has to learn. This is as true of Microsoft products as it is of Google's.
Overall, it appears to me that the Android docs don't always succeed in getting down to that beginner level. But this is perhaps my own perfectionism: they were good enough for me to get up and running. And I find my problems also reflected (and solved) on sites like StackOverflow.
I guess the bottom line is, since Eclipse is open source, if something bothers me enough, I should quit whining about it, and jump in and contribute code. Not sure I have the spare cycles to do that though...