Setting up Android Studio
In this section, you will learn how to set up the official Android Studio IDE on different desktop platforms.
Windows
Java Development Kit (JDK) is essential for the functioning of Android Studio.
- Download and install the latest version of JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Download the correct architecture, x86 for the 32-bit OS, as shown in the following screenshot:
- Next, install and configure Android Studio on your PC. Download the Android Studio bundle from http://developer.android.com/sdk/index.html.
- Run the downloaded executable and follow the onscreen instructions, as shown in the following screenshot:
- Next, we will see the following screen:
It may take some time for it to install. It may download some of the required components. Now, you have successfully installed Android Studio with SDK.
Mac OS X
We need JDK for Android Studio to work.
- Download JDK 7 for OS X from http://www.oracle.com/technetwork/java/javase/downloads/index.html.
- Open the downloaded
.dmg
file. A window will appear with a.pkg
file. Double-click to launch the installer and follow the onscreen instructions:Google recommends us to use JRE 6 for optimized font rendering. Similarly, download and install JRE 6.
- Next, download and install Android Studio.
- Download Android Studio for OS X from http://developer.android.com/sdk/index.html.
- Open the downloaded
.dmg
file. Drag and drop Android Studio in theApplications
folder: - Then, open Android Studio and continue with the setup process. Now, you have set up Android Studio on OS X.
Linux
Ubuntu is one of the most popular Linux distributions, which is based on Debian. Here, I am giving instructions to set up Android Studio in the Ubuntu distribution. The Ubuntu version I am using is version 14.10.
The first major requirement is the installation of Oracle Java. It is not available in the official Ubuntu PPA repository. So, we are going to download and install it from a third-party PPA repository.
- Open the Terminal or use the shortcut key Ctrl + Alt + T. Install Oracle Java 7 using the following commands. Enter it one by one:
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
- You can install Oracle Java 8 by replacing the last command with the following:
sudo apt-get install oracle-java8-installer
- Now, let's check whether we have setup Android Studio correctly. Enter the following command in the Terminal:
java -version
It should return an output similar to the following:
java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
If you are using the 64-bit distribution of Ubuntu, you need to install some packages to get the 32-bit applications supported. If you are using version 13.10 or above, use these commands in the Terminal:
sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
For the earlier versions of Ubuntu, use the following command:
sudo apt-get install ia32-libs
- Now, our initial setup is done. Download Android Studio for Linux from http://developer.android.com/sdk/index.html.
- Extract the downloaded ZIP package. Navigate to the
android-studio/bin
directory and execute thestudio.sh
shell script. Android Studio will start. Follow the onscreen instructions.
Now, you have set up Android Studio on Linux.
Setting up Eclipse with the ADT plugin
In this section, you will learn how to set up the Eclipse IDE with ADT on different desktop platforms.
Windows
The Oracle Java JDK is required for the functioning of Eclipse.
- Follow the same instructions given in the Setting up Android Studio section for installing Java. After installing Java, let's proceed to the next step.
- Next, we need to download the Eclipse IDE. Visit the following link and download the Eclipse IDE for Java developers: https://eclipse.org/downloads/index.php.
- Now, extract the downloaded ZIP package and run the
eclipse.exe
executable. Eclipse will be running. We need to set up SDK and download the Android SDK standalone installer from http://developer.android.com/sdk/index.html. - Run the downloaded executable and follow the onscreen instructions.
- Set up the ADT plugin in Eclipse. Open Eclipse and select Help | Install New Software.
- A dialog box will appear. Enter the following URL and hit Enter: https://dl-ssl.google.com/android/eclipse/. Wait until it fetches information.
- Now, check the Developer Tools box and select Next. Accept the agreements and the ADT plugin will be downloaded and installed. Then, Eclipse will restart and ADT will be integrated with Eclipse successfully. Select Window | Preferences.
- Set the SDK location in the Android section. Hit Apply. Success! You have done it.
Mac OS X
Follow the same instructions given in the Setting up Android Studio section for Installing Java. After you have installed Java, proceed to the next step:
- Visit https://eclipse.org/downloads/index.php and download the OS X version of the Eclipse IDE for Java developers.
- Open the downloaded archive. Drag the
eclipse
folder to theApplications
directory. To open Eclipse, open the Eclipse executable from theeclipse
folder in theApplications
directory. Next, we need to set up SDK. Download the Android SDK Tools standalone package for OS X from http://developer.android.com/sdk/index.html. - Extract the downloaded SDK package. The ADT plugin setup is same as the setup on Windows. Now, you have set up Eclipse ADT with SDK on OS X.
Linux
Follow the same instructions given in the Setting up Android Studio section for Installing Java. After you have installed Java, proceed to the next step:
- Now, we need to download the Eclipse IDE. Visit https://eclipse.org/downloads/index.php and download the Linux version of the Eclipse IDE for Java developers.
- Extract the downloaded ZIP package and run the Eclipse executable. Eclipse will be running. Next, we need to set up SDK. Download the Android SDK Tools standalone package for Linux from http://developer.android.com/sdk/index.html.
- Extract the downloaded SDK package. The ADT plugin setup is same as the setup on Windows. Now, you have set up Eclipse ADT with SDK on Linux.
Downloading and setting up Google Play services
The Google Play services SDK is required to work with Google Maps. Google Play services can be only installed from the SDK Manager.
- Open the SDK Manager via Android Studio by selecting Tools | Android | SDK Manager.
- You can open the SDK Manager via Eclipse by selecting Window | SDK Manager.
The following screenshot shows the Android SDK Manager:
- Scroll down to the bottom. Under the Extras section, check Google Play services and select Install packages. The Google Play services package will then be downloaded and installed. If it is successfully installed, it will show the status as Installed.
Downloading the Google APIs System Image
We need the Google APIs System Image to test the Google Maps application on our PC. These system images have Google Play services preinstalled, which helps us test our Maps application. Open SDK Manager. Under each Android API section, you will find a Google APIs system image. You can use the ARM image or x86 image as per your own requirements. Now, select and install the system image.