The Development Environment

Intro

The first thing we’ll need to do before we can start developing Android apps is to set up the development environment.  You have several option when it comes to how you will go about writing apps.  As with any software, you could choose to use a plain text editor to write your code, and compile and link it manually...but this is highly inefficient.  

Up until recently, the Google-recommended method was to use the Eclipse Integrated Development Environment (IDE) with a plugin for the Google-provided Android development tools.  At the end of 2015, Google discontinued support for the Eclipse plugin.  As of December, 2014, the official IDE solution for Android development is to use the Android Studio.  Android Studio is an IDE created by Google specifically for the Android OS.  It is based on the IntelliJ IDEA IDE.  

For all the lessons in this course we will use Android Studio exclusively.  After you get Android Studio up and running on your machine, be sure to take a minute to familiarize yourself with it: http://developer.android.com/tools/studio/index.html 

Software Installation

Luckily for us, Google has made the whole process of setting up Android Studio very simple by providing a software installation package containing the IDE preloaded with all necessary plugins.  To install Android Studio:

You have successfully installed the IDE, but we're not ready yet!  The first time you run the program it will go through the process of downloading and updating the Android Software Development Kit (SDK).  This will take a few minutes.  Wait patiently while the SDK is updated.

Since we're waiting anyway, let's take this opportunity to get acquainted with Android Studio.  Move on to the next section...

Pieces of the Puzzle

Because one of our goals is to actually learn what’s going on behind the scenes and gain an understanding of how the pieces of of development environment fit together, let’s take a minute to examine some of the more important tools provided in Android Studio.

Android Studio provides a full-fledged IDE built which interacts directly with the Android SDK.  It also provides the developer a convenient way to create and manage Android Virtual Devices (AVDs), and use the Device Monitor (what’s that, you ask?  keep reading...).  All of these tools can be used as stand-alone programs if desired.  Using the IDE, we can run them all directly from Android Studio by selecting the appropriate menu option (this may be in a different menu based on your OS):

 

There are many more features and capabilities included in the Android Developer Tools.  We won’t get a chance to look at them today, but throughout the course many of them will be introduced as needed in the process of app development.

Verifying Successful Install

Hopefully at this point the SDK has finished updating.  Now that we have all the software we need, and we have a basic understanding of what each piece does for us, let’s make sure everything works properly.  

System Images

The first thing we need to check is that you have the proper system image(s) installed.  To do this, we will use the SDK Manager.  

Open the Android SDK Manager.  The SDK Platforms tab shows you which packages are installed.  By default, the most current API level is installed when you install Android Studio.  For his class you will also need the API Level 16 package.  Click the box beside "Android 4.1.2" and click the Apply button to install the package:

Another important function of the SDK Manager is the installation of tools needed for specific functionality.  For example, in order to use Google Maps in your app, you must have Google Play services installed.  You can see the available tools by clicking on the "SDK Tools" button:

Installing the new SDK package may take a minute depending on the speed of your internet connection, so sit back and imagine how you're going to take over the world with your new Android skillz...

...whew, that took a while.  

Android Virtual Devices

Once everything has finished installing, we need to create an Android Virtual Device (AVD) for testing. In this class, we will use a standardized AVD, which you'll create following the steps below.  However, in the AVD Manager we can create and edit AVDs, with different devices corresponding to different versions of Android.  I encourage you to do extensive testing on mulitple device configurations before you ever think of releasing an app.

To create an AVD:

 

If you see "failed to load" in the Actions section for your new AVD, restart Android Studio and then reopen the AVD Manager.  You should now see the green launch icon.  This appears to be a bug with some Windows versions.

 

If everything went the way it should, you'll be rewarded with your very own Android emulator!

 

 

The AVD is a convenient tool for testing your apps during the development process.  Using the Device Monitor, you can emulate incoming phone calls and text messages, change GPS coordinates, set simulated network speeds, and much more.  Launch the Device Monitor and change some of the AVD settings.

When developing apps, it's advised to have multiple AVDs for testing.  Why?  Remember, there are several different version of Android, and an even larger variety of screen sizes and resolutions that you should account for.  You can create an AVD to cover most use cases.

Conclusion

You now have a verified working development environment!  All the tools you need to create basic Android applications are installed.  For later lessons, we'll need to add to this configuration to add more advanced functionality; but let's not get ahead of ourselves.

Now that everything's up and running, it's time to learn how to build apps!!