Friday, 19 December 2014

Get Started with Android Studio

Android Studio for Beginners

Google makes lots and lots of new announcements.  Some of them turn into great successes, like the 2007 announcement of Android.  Some of them flop immediately, like the announcement of the Open Handset Alliance (supposedly to guide the Android standard, but apparently hiding in the witness protection program).  And some Google announcements are clearly going to be important one day, but we just don't know when.


Android Studio was the opening presentation at Google IO 2013, and falls into the "clearly important, but we don't know when" category.  In that sense, it's a bit like the new webp image format, launched by Google 18 months ago, but still not moving the needle outside the Googleplex and Facebookplex.
Changing development tools is not a trivial matter.  Most of us have put in significant effort to be productive in Eclipse, and we don't relish the non-productive task of re-learning all the tricks of a new IDE, even though we know we have to do it sooner or later.

This blog post reminds you that Android Studio is only going to become more important, and lists key resources to get you started.   Whether you work through these now, or bookmark and put it off till you can make it a New Years resolution, these links will help you get familiar with Android Studio.
Studio is based on the open source edition of the very popular IntelliJ IDE.  It is in widespread use and has been proven over a dozen years.  You'd think there would be a profusion of "Get started with Studio" blogs. But you would be wrong about that.   There are 360,000 hits on YouTube, though.  Let me know if you find a good one.
 
Although IntelliJ IDEs have been around a long time, that's not the case for the Android Studio incarnation, which is Google's brainchild.   Accordingly, you may hit bugs in Studio.  Bugs in open source Android projects (like Studio) can be reported here and bugs in Google's private code here - like most developers, Google only fixes the bugs they know about.
Here are my top ten annotated resources for learning Android Studio, in rough order of application.
  1. http://developer.android.com/sdk/installing/studio.html  download and install Studio.  The IDE is currently in Beta, so don't use it on any project in a critical phase.
  2. http://developer.android.com/sdk/installing/migrate.html  read Google's notes on "Migrating from Eclipse".  Watch out for items that are no longer in sync with the build you downloaded.   The code changes sometimes get ahead of the docs.    Also check out http://developer.android.com/sdk/installing/studio-tips.html which is not about installing at all.  It's a collection of simple but essential features.  Among other things, it explains why your files are laid out differently compared with Eclipse (to help the new Gradle build system).
  3. http://tools.android.com/ bookmark and check in with the website of Google's Android tools team. Note that a new beta release of Studio, December 8th, 2014 - Android Studio 1.0 Released!. These guys are working hard towards the general release.
  4. http://www.gradle.org/docs/current/userguide/userguide_single.html  Studio flips the underlying Android build system from Ant (which is XML-based and showing its age) to Gradle (which has the benefit of having another go at the things that didn't work well in earlier systems).  This is a lengthy user guide to Gradle, but worth skimming and noting items for later study.
  5. http://gradleware.com/registered-access?content=books%2Fbuilding-and-testing%2F  An O'Reilly book on Gradle, with free online access (registration required).   Read the first 3 or 4 chapters, then return as needed.   My colleague Ian Harris also wrote a couple of nice blog posts on Gradle, one that's a brief overview, and one that describes in detail how to get Gradle to include the Golgi library when building your app or server code.
     
  6. http://www.i-programmer.info/programming/android/5887-android-adventures-getting-started-with-android-studio.html  A  good online e-book with the first chapter dedicated to using Android Studio.  The e-book comes with the promise that it will be updated regularly.  Note the advice to "make sure you have the latest Java JDK installed". Android acquired the ability to work with Java 7 with the KitKat build, and version 0.6.12 of Studio's gradle plugin.   You'd already know this if you were following item 3 on this list, because they announced it here.   Whoo hoo!  Diamond operator, multi-catch, strings in switches, try with resources, here we come!
     
  7. http://www.i-programmer.info/programming/android/5887-android-adventures-getting-started-with-android-studio.html walks you gently through installation and basic use of Android Studio.  The pages are quick to read and follow along.   If you only have time to read one of the links in this post, maybe it should be this one.   And maybe this one, too.  :-)
     
  8. http://code.tutsplus.com/tutorials/getting-started-with-android-studio--mobile-22958 this tutorial focuses on the basic functions of Studio.  It's good to run through this tutorial once, with Studio running on your development system, to confirm and practice all the essential tasks that are second nature in Eclipse.
     
  9. http://www.avocarrot.com/blog/5-killer-features-android-studio-know/ this blog post describes more about 5 new features of Studio.   Learn all about the wizards, one of which provides statistics on installed base as you choose the API level for a project.  Here's what one Studio fan had to say about the good stuff he found.
     
  10. https://developers.google.com/events/io/sessions/324603352  The Google IO post that kicked everything off.  This was where Google uncloaked their project to get out of the Eclipse business and into the Android-specific IDE business.  
If anyone knows a way to play that last video speeded up, please post in a comment below.  The IO talk is more than 50 minutes long, which exceeds my monthly budget for thinking about tools specifically.  I prefer tools that just work in the background without me having to think about them, or even worse code around them (like the common error message in Eclipse, when importing a new project, about the "@override" annotation - caused by a down-rev Java version).
One final hint about Studio - you'll see the words "project" and "module" bandied around a lot.  A Studio project is roughly like an Eclipse workspace.  A project in Studio is "an organizational unit representing a complete software solution.  Projects don't directly contain source code."  Projects may contain modules, which do have source code.  A module is a unit of functionality which can be compiled, run, tested and debugged independently.  A build script is regarded as a module, for example.  An Android Studio module is roughly like an Eclipse project.  This blog post explains the reasons for moving to Studio, and some of the new features to try.
What are your favorite Android Studio tips or webpages?  Please post a comment to share with other developers.
 

Beginning to Android Studio

Android Studio Simple Installation Way
The release is available in both the canary channel and the dev channel, so you can check for updates via Help > Check for Update... (on OSX, look in the Android Studio menu). This will download and install a patch rather than download a full IDE image. For all older other versions you will need to install it from scratch by installing one of the below .zip files. 

Zip Files:
Installers:
We don't have installer builds for this version (at least not yet). Just use the installers for 1.0.1 and then Check For Updates within the IDE.

SHA-1 Checksums:
dc1cd13fca1d3dc2b4f63d27aaee7ea7985be1a1  android-studio-ide-135.1653844-linux.zip
9d8058825ad862c162ae92316bec3d209d07e4c8  android-studio-ide-135.1653844-mac.zip
58786df1f69cd03ad0b603613ca989387f14eddd  android-studio-ide-135.1653844-windows.zip