We are surrounded by technologies, gadgets and some of them have become our closest friends. We can stay away from our family for months but it's very difficult to live a single day without keeping in touch with these friends. :)
I feel lucky to be a part of this generation where we experienced so many revolutions in the fields of technology and smartphone is obviously one of the biggest revolutions of our era. Now, when we talk about smartphones, how can we stay away from Android! :)
Popularity of Android phones is increasing day by day hence developing applications for Android OS is obviously on demand. Apart from smartphones and tablets, Android provides interfaces for televisions (Android TV), cars (Android Auto), wrist watches (Android Wear) and many more. To start developing android applications, you have to setup the environment first.
In this article, I'm going to talk about how one can setup Android Development Environment. I'll try my best to explain the steps comprehensively and concisely in this article and hope you enjoy the read! :)
- Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
- Mac OS X 10.5.8 or later (x86 only)
- Linux (tested on Ubuntu Linux, Lucid Lynx)
- GNU C Library (glibc) 2.7 or later is required.
- On Ubuntu Linux, version 8.04 or later is required.
- 64-bit distributions must be capable of running 32-bit applications
Note: In this article, I'll consider Windows 8 (64-bit) operating system.
- JDK 6 or greater version
- Android Studio
Downloads and Installations
There are multiple tools available in the market to develop Android applications. As a beginner, anyone can easily get confused while choosing one out of all those options.
In this article, we’ll talk about using Android Studio which provides everything you need to start developing apps, including the Android SDK tools and the Android Studio IDE (powered by IntelliJ) to streamline your Android app development.
But, before you set up Android Studio, be sure you have installed JDK 6 or greater (the JRE alone is not sufficient).
- JDK – Let’s download the latest JDK available from the following link and then install:
Note: Make sure that you download the appropriate version (i.e. for 32-bit or 64-bit) for your system.
- Android Studio – Download the latest version of Android Studio from the following link:
To set up Android Studio on Windows:
1. Let's launch the downloaded EXE file, android-studio-bundle-<version>.exe and click Next button
2. Keep the default selection and click on Next button:
3. Let's keep the default Destination Folder path and click Next button:
4. Click Install button:
5. Installation will start as shown below:
6. Once the installation is completed, it will show the message > click Next button:
7. Click Finish button to complete the installation:
It will start Android Studio!
Note: After installation when you try to open Android Studio, the launcher script may not find where Java is installed and a popup is shown as follows:
If you encounter this problem, you need to set an environment variable indicating the correct location (JDK).
Open System Properties from Control Panel > click System (or press +) > click Advanced System Settings > open Advanced tab:
Click Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.8.0_11
Android Studio is now ready and loaded with the Android developer tools, but there are still a couple packages you should add to make your Android SDK complete.
Adding SDK Packages
You have to download some packages using the Android SDK Manager before you can start developing.
- Open Android Studio > click Configure option on Quick Start menu > click SDK Manager
- You will see some of the packages are already selected. Let's keep them selected and select some other required Tools and Packages as shown below:
- Android SDK Tools
- Android SDK Platform-tools
- Android SDK Build-tools (highest version available)
- SDK Platform (under the latest Android x.x folder)
- A system image for the emulator, such as ARM EABI v7a System Image
- Click Install packages button to start installation of the selected tools and packages.
It'll show a popup once installations are completed:
Now you're done setting up Android Studio and ready to build your first Android app!
Note: Make sure you download latest packages from SDK Manager when new tools/API would be available.
Creating Android Virtual Device (emulator)
Before we jump into developing Android application, first we've to create a virtual device (an emulator) where the application can run. Otherwise we can also run the apps on a real device.
In this article, we'll discuss how one can create an Android Vertual Device.
1. Let's launch AVD Manager by pressing +Q keys > type AVD Manager in App search > select AVD Manager from the searched result and press Enter key to open AVD Manager > click Create button
2. Fill in the details for the AVD: Give it a name, select a Device, a platform target, and a skin (HVGA is default) >
Note: You may find that the OK button is disabled. In case there is no system image is installed for the selected target, the OK button remains disabled. So, make sure that you select a Target for which system image (i.e. ARM EABI v7a System Image) is already installed. Otherwise you have to install the required system image from Android SDK Manager.
3. Select the new AVD from the Android Virtual Device Manager and click Start button
4. This might take few minutes to boot up the emulator. Once it's ready just unlock the emulator screen.
Bingo!!! our mission is acomplished! :)
Creating AVD from Device Definitions
In the above section, we saw how to create an Android Virtual Device by providing all the required details manually. There is another option available through which one can create an AVD quite easily.
1. Let's launch AVD Manager > click Device Definitions tab which will show a list of all known device definitions > select one device and click Create AVD button:
2. Create new Android Virtual Device window will be opened with prepopulated values from the selected Device Definition > click OK button
3. It will create the AVD and show a popup message as shown below:
Tips and Best Practices
In this section, I'll point out some tips and best practices which can be helpful during setting up your Android Development Environment:
- If the installation of SDK components fails, run the SDK manager as Administrator.
- When installing any software mentioned in this guide, always make sure to install the version that is compatible with your OS version (32- or 64-Bit). Failure to do so may cause compatibility errors later on.
- When installing the JDK or Android Studio, it's better to choose any drive other than C: drive. Simply the reason is that C: drive is generally used for OS and if you have to format C: drive due to any reason, you may have to setup all these again from scratch. This is just a tip and not a rule. :)
In this article, first we discussed about the systems requirements for Android applicaion development. Later on we saw what are the tools need to be downloaded and how to install Android Studio in step-by-step approach. Then we discussed about how we can add SDK packages using Android SDK Manager and finally discussed about how to create Android Virtual Device (emulator) using AVD Manager.
Hope you like this article. Please leave your comment/suggestion and don't forget to rate.
Points of Interest
Please visit the below link for more details:
- 19th July, 2014: Initial version
- 20th July, 2014: Added Tips and Best Practices section
- 27th July, 2014: Added Creating AVD from Device Definitions section