Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Android Studio 2 Essentials - Second Edition
Android Studio 2 Essentials - Second Edition

Android Studio 2 Essentials: A fast-paced guide to get you up and running with Android application development using Android Studio 2, Second Edition

By Belén Cruz Zapata
€14.99 per month
Book Jun 2016 172 pages 2nd Edition
eBook
€22.99 €8.99
Print
€28.99
Subscription
€14.99 Monthly
eBook
€22.99 €8.99
Print
€28.99
Subscription
€14.99 Monthly

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Android Studio 2 Essentials - Second Edition

Chapter 1. Installing and Configuring Android Studio

The new and official Google Integrated Development Environment (IDE) Android Studio 2.0 with all its varied features is ready to be explored. How would you like to make your own Android applications and make these applications available to other users on Google Play Store? Can you do this easily? How can you achieve this?

This chapter will show you how to prepare your new Android Studio installation and help you take your first steps in the new environment. We will begin by preparing the system for the installation and downloading the required files. We will see the welcome screen that prompts when running Android Studio for the first time, and we'll configure the Android Software Development Kit (SDK) properly so that you have everything ready to create your first application.

These are the topics we'll be covering in this chapter:

  • Installing Android Studio

  • Running Android Studio for the first time

  • Configuring the Android SDK

Preparing for installation


A prerequisite to start working with Android Studio is to have Java installed on your system. The system must also be able to find the Java installation. This can be achieved by installing the Java Development Kit (JDK) on your system and then setting an environment variable named JAVA_HOME, which points to the JDK folder in your system. Check this environment variable to avoid issues during the installation of Android Studio.

Downloading Android Studio


The Android Studio package can be downloaded from the Android developer tools web page at http://developer.android.com/sdk/index.html by clicking on the download button, as is shown in the next screenshot. This package will be an EXE file for Windows systems, a DMG file for Mac OS X systems, or a TGZ file for Linux systems:

Installing Android Studio


In Windows, launch the EXE file. The default installation directory is \Users\<your_user_name>\AppData\Local\Android\android-studio. The AppData directory is usually a hidden directory.

In Mac OS X, open the DMG file and drop Android Studio into your Applications folder. The default installation directory is /Applications/Android\ Studio.app.

In Linux systems, unzip the TGZ file and execute the studio.sh script located at the android-studio/bin/ directory.

If you have any problem in the installation process or in the following steps, you can get help about it and the known issues by checking Appendix, Getting Help.

Running Android Studio for the first time


Execute Android Studio and wait until it loads completely. This may take a few minutes the first time. The first time you execute Android Studio, you will be prompted by a welcome screen. As shown in the following screenshot, the welcome screen provides options to start a new project, open a project, import a project, or even perform more advanced actions, such as checking out a project from a version control system or modifying the configuration options:

Let's have a look at the various options available on the welcome screen:

  • Start a new Android Studio project: This creates a new Android project from scratch

  • Open an existing Android Studio project: This opens an existing project

  • Check out project from Version Control: This creates a new project by importing existing sources from a version control system

  • Import project (Eclipse ADT, Gradle, etc.): This creates a new project by importing existing sources from your system

  • Import an Android code sample: This imports a project containing the official Google code samples from GitHub (https://github.com/googlesamples)

The welcome screen, in addition to the main actions, also contains a configuration menu and a help menu, as described in the following:

  • Configure: This opens the configuration menu. The configuration menu has the following options:

    • SDK Manager: This opens the Android SDK tool that will be explained in Chapter 6, Tools.

    • Preferences: This opens the Android Studio preferences.

    • Plugins: This opens the plugins manager for Android Studio.

    • Import Settings: This imports the settings from a file (.jar).

    • Export Settings: This exports the settings to a file (.jar).

    • Settings Repository: This allows you to enter the URL of an external code repository.

    • Check for Update: This checks if there is an Android Studio update available.

    • Project Defaults: This opens the project default settings menu.

    • Settings: This opens the template project settings. These settings are also reachable through the Android Studio settings (Configure | Settings).

    • Project Structure: This opens the project and platform settings.

    • Run Configurations: This opens the run and debug settings.

  • Get Help: This opens the help menu:

    • Help Topics: This opens the Android Studio help, an online version

    • Tips of the Day: This opens a dialog with the tip of the day

    • Default Keymap Reference: This opens an online PDF containing the default keymap

    • Plugin Development: This opens a JetBrains website containing information for plugin developers

Configuring the Android SDK


The essential feature that has to be correctly configured is the Android SDK. Although, Android Studio automatically installs the latest Android SDK available, so you should already have everything you need to create your first application. It is important to check it and learn how we can change it.

In the Android Studio welcome screen, navigate to Configure | Project Defaults | Project Structure. In SDK Location, you should have a selected Android SDK location as shown in the following screenshot. This selected SDK location is the default that will be used in our Android projects; however, we can change it later for specific projects that require special settings.

If you do not have an Android SDK configured in Android Studio, then we have to add it manually.

To accomplish this task, click on the ellipsis (...) button to add an Android SDK and then select the home directory for the SDK. Check whether you have it in your system by navigating to your Android Studio installation directory. You should find a folder named sdk, which contains the Android SDK and its tools. The Android Studio installation directory may be in a hidden folder; so, click on the button highlighted in the following screenshot to Show Hidden Files and Directories:

If you wish to use another Android SDK location that is different from the one included with Android Studio, select this instead. For example, if you previously used the Android Development Tools (ADT) plugin for Eclipse, you already have an Android SDK installation in your system.

Summary


We have successfully prepared the system for Android Studio and installed our Android Studio instance. We ran Android Studio for the first time, and now we know the options available in the welcome screen. You have also learned how to configure our Android SDK and to install it manually, in case you wish to use a different version. Completing these tasks will leave your system with Android Studio running and configured to create your first project.

In the next chapter, you will learn about the concept of a project and how it includes everything the application requires, from classes to libraries. We will create our first project and discuss the different kinds of activities available in the wizard.

Left arrow icon Right arrow icon

Key benefits

  • Configure, build, and run Android projects with Android Studio 2
  • Test your apps using the Android emulator and learn how to manage virtual devices
  • Explore how Android Studio 2 can be made a part of your workflow to reduce the overall development time

Description

Android Studio 2, the official IDE for Android application development, dramatically improves your workflow by letting you quickly see changes running on your device or emulator. It gives developers a unique platform by making app builds and deployment faster. This book will get you up and running with all the essential features of Android Studio 2 to optimize your development workflow. Starting off with the basic installation and configuration of Android Studio 2, this book will help you build a new project by showing you how to create a custom launcher icon and guiding you to choose your project. You will then gain an insight into the additional tools provided in Android Studio, namely the Software Development Kit (SDK) Manager, Android Virtual Device (AVD) Manager, and Javadoc. You’ll also see how to integrate Google Play Services in an Android project. Finally, you’ll become familiar with the Help section in Android Studio, which will enable you to search for support you might require in different scenarios.

What you will learn

[*] Install Android Studio on your system and configure the Android Software Development Kit [*] Create your first project and explore its structure [*] Manage a project in Android Studio 2 with Gradle [*] Improve your productivity while programming by getting the best of the code editor [*] Design the user interface using layouts and see how to handle various user events [*] Integrate Google Play services into your project efficiently [*] Monitor your app while it s running and constantly improve its performance

Product Details

Country selected

Publication date : Jun 28, 2016
Length 172 pages
Edition : 2nd Edition
Language : English
ISBN-13 : 9781786467959
Vendor :
Google
Category :

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


Publication date : Jun 28, 2016
Length 172 pages
Edition : 2nd Edition
Language : English
ISBN-13 : 9781786467959
Vendor :
Google
Category :

Table of Contents

17 Chapters
Android Studio 2 Essentials Second Edition Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewer Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
1. Installing and Configuring Android Studio Chevron down icon Chevron up icon
2. Starting a Project Chevron down icon Chevron up icon
3. Navigating a Project Chevron down icon Chevron up icon
4. Using the Code Editor Chevron down icon Chevron up icon
5. Creating User Interfaces Chevron down icon Chevron up icon
6. Tools Chevron down icon Chevron up icon
7. Google Play Services Chevron down icon Chevron up icon
8. Debugging Chevron down icon Chevron up icon
9. Preparing for Release Chevron down icon Chevron up icon
Getting Help Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Top Reviews
No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.