Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Android Application Development

You're reading from   Learning Android Application Development Start building for the world's most popular mobile platform

Arrow left icon
Product type Paperback
Published in Aug 2016
Publisher Packt
ISBN-13 9781785286117
Length 320 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Raimon Ràfols Montane Raimon Ràfols Montane
Author Profile Icon Raimon Ràfols Montane
Raimon Ràfols Montane
Laurence Dawson Laurence Dawson
Author Profile Icon Laurence Dawson
Laurence Dawson
Arrow right icon
View More author details
Toc

Setting up Android Studio

Before being able to build an Android application, we have to download and install Android Studio on our computer. It is still possible to download and use Eclipse with the Android Development Tools (ADT) plugin, but Google no longer supports it and they recommend that we migrate to Android Studio. In order to be aligned with this, we will only focus on Android Studio in this book. For more information on this, visit http://android-developers.blogspot.com.es/2015/06/an-update-on-eclipse-android-developer.html.

Getting the right version of Android Studio

The latest stable version of Android Studio can be found at http://developer.android.com/sdk/index.html.

Getting the right version of Android Studio

If you are among the bravest developers, and you are not afraid of bugs, you can always go to the Canary channel and download the latest version. The Canary channel is one of the preview channels available on the Android tools download page (available at http://tools.android.com/download/studio) and contains weekly builds.

The following are other preview channels available at that URL:

  • The Canary channel contains weekly builds. These builds are tested but they might contain some issues. Just use a build from this channel if you need or want to see the latest features.
  • The Dev channel contains selected Canary builds.
  • The Beta channel contains the beta milestones for the next version of Android Studio.
  • The Stable channel contains the most recent stable builds of Android Studio.

The following screenshot illustrates the Android Tools download page:

Getting the right version of Android Studio

Note

It is not recommended to use an unstable version for production. To be on the safe side, always use the latest stable version. In this book, we will use the 2.2 preview version. Although it is a beta version at this moment, we will have the main version quite soon.

Installing Android Studio

Android Studio requires JDK 6 or higher: JDK 7 is required as a minimum if you aim to develop for Android 5.0 and higher. You can easily check which version you have installed by running this on your command line:

javac -version

If you don't have any version of the JDK or you have an unsupported version, please install or update your JDK before proceeding to install Android Studio.

Refer to the official documentation for a more comprehensive installation guide and details on all platforms (Windows, Linux, and Mac OSX) at http://developer.android.com/sdk/installing/index.html?pkg=studio.

Once you have JDK installed, unpack the package you have just downloaded from the Internet and proceed with the installation. For example, let's use Mac OSX. If you download the latest stable version, you will get a .dmg file that can be mounted on your filesystem. Once mounted, a new Finder window will appear and will ask us to drag the Android Studio icon to the Applications folder. Just doing this simple step will complete the basic installation.

Installing Android Studio

If you have downloaded a preview version, you will have a ZIP file that once unpacked will contain the Android Studio Application directly (it can be just dragged to the Applications folder using Finder).

Installing Android Studio

For other platforms, refer to the official installation guide provided by Google at the web address mentioned earlier.

First run

Once you have finished installing Android Studio, it is time to run it for the first time. On the first execution (at least if you have downloaded version 2.2), it will let you configure some options and install some SDK components if you choose the custom installation type. Otherwise, both these settings and SDK components can be configured or installed later.

The first option you will be able to choose is the UI theme. We have the default UI theme or the Darcula theme, which basically is a choice of light or dark backgrounds, respectively.

First run

After this step, the next window will show the SDK Components Setup where the installation process will let you choose some components to automatically download and install. On Mac OS, there is a bug in some versions of Android Studio 2.0 that sometimes does not allow selecting any option if the target folder does not exist. If that happens, follow these steps for a quick fix:

  1. Copy the contents of the Android SDK Location field, just the path or something like /Users/<username>/Library/Android/sdk, to the clipboard.
  2. Open the terminal application.
  3. Create the folder manually asmkdir /Users/<username>/Library/Android/sdk.
  4. Go back to Android Studio, press the Previous button, and then the Next button to come back to this screen. Now, you will be able to select the components that you would like to install.
  5. If that still does not work, cancel the installation process, ensuring that you checked the option to rerun the setup on the next installation. Quit Android Studio and rerun it.

    First run

You have been reading a chapter from
Learning Android Application Development
Published in: Aug 2016
Publisher: Packt
ISBN-13: 9781785286117
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image