Android Studio 2 Essentials - Second Edition
()
About this ebook
- 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
If you are an Android developer looking to quickly take advantage of Android Studio 2 and add it to your workflow, then this book is for you. It is assumed that you are familiar with the OOP paradigm and Java. It is recommended that you have prior knowledge of the main characteristics of the Android mobile system in order to get the most out of this book.
Related to Android Studio 2 Essentials - Second Edition
Related ebooks
Learn iOS Application Development: Take Your Mobile App Development Skills to the Next Level with Swift and Xcode (English Edition) Rating: 0 out of 5 stars0 ratingsSwift 2 Design Patterns Rating: 0 out of 5 stars0 ratingsFlutter for Jobseekers: Learn Flutter and take your cross-platform app development skills to the next level (English Edition) Rating: 0 out of 5 stars0 ratingsAsynchronous Android Rating: 4 out of 5 stars4/5Android Application Development with Maven Rating: 0 out of 5 stars0 ratingsMeteor Design Patterns Rating: 0 out of 5 stars0 ratingsMastering Android Game Development Rating: 0 out of 5 stars0 ratingsLearning Android Game Development Rating: 0 out of 5 stars0 ratingsiOS 13 Programming for Beginners - Fourth Edition: Get started with building iOS apps with Swift 5 and Xcode 11, 4th Edition Rating: 0 out of 5 stars0 ratingsFundamentals of Android App Development: Android Development for Beginners to Learn Android Technology, SQLite, Firebase and Unity Rating: 0 out of 5 stars0 ratingsAndroid Application Programming with OpenCV Rating: 3 out of 5 stars3/5Getting Started with Meteor.js JavaScript Framework - Second Edition Rating: 0 out of 5 stars0 ratingsMastering Android Application Development Rating: 5 out of 5 stars5/5Learning Swift - Second Edition Rating: 0 out of 5 stars0 ratingsApplication Development with Swift Rating: 0 out of 5 stars0 ratingsOpenCV Android Programming By Example Rating: 0 out of 5 stars0 ratingsMastering Android NDK Rating: 0 out of 5 stars0 ratingsGradle for Android Rating: 0 out of 5 stars0 ratingsAndroid Design Patterns and Best Practice Rating: 5 out of 5 stars5/5Mastering MeteorJS Application Development Rating: 4 out of 5 stars4/5Xamarin Mobile Application Development for Android - Second Edition Rating: 0 out of 5 stars0 ratingsSwift 3 Game Development - Second Edition Rating: 0 out of 5 stars0 ratingsInstant HTML5 2D Platformer Rating: 0 out of 5 stars0 ratingsThe Android Game Developer's Handbook Rating: 0 out of 5 stars0 ratingsAndroid Studio Electric Eel Essentials - Java Edition: Developing Android Apps Using Android Studio 2022.1.1 and Java Rating: 0 out of 5 stars0 ratingsiOS and OS X Network Programming Cookbook Rating: 0 out of 5 stars0 ratingsMeteor Cookbook Rating: 5 out of 5 stars5/5jQuery Game Development Essentials Rating: 0 out of 5 stars0 ratingsiOS Game Programming Cookbook Rating: 0 out of 5 stars0 ratingsFlash Development for Android Cookbook Rating: 3 out of 5 stars3/5
Software Development & Engineering For You
Python For Dummies Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5How Do I Do That in Photoshop?: The Quickest Ways to Do the Things You Want to Do, Right Now! Rating: 4 out of 5 stars4/5Wordpress 2023 A Beginners Guide : Design Your Own Website With WordPress 2023 Rating: 0 out of 5 stars0 ratingsAdobe Illustrator CC For Dummies Rating: 5 out of 5 stars5/5Level Up! The Guide to Great Video Game Design Rating: 4 out of 5 stars4/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5Hand Lettering on the iPad with Procreate: Ideas and Lessons for Modern and Vintage Lettering Rating: 4 out of 5 stars4/5Photoshop For Beginners: Learn Adobe Photoshop cs5 Basics With Tutorials Rating: 0 out of 5 stars0 ratingsModern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsBeginning Programming For Dummies Rating: 4 out of 5 stars4/5Beginning C++ Programming Rating: 3 out of 5 stars3/53D Printing Designs: Fun and Functional Projects Rating: 0 out of 5 stars0 ratingsAndroid App Development For Dummies Rating: 0 out of 5 stars0 ratingsLearning Processing: A Beginner's Guide to Programming Images, Animation, and Interaction Rating: 5 out of 5 stars5/527 PROGRAM MANAGEMENT INTERVIEW TECHNIQUES - To Ace That Dream Job Offer ! Rating: 5 out of 5 stars5/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Blender 3D Printing Essentials Rating: 0 out of 5 stars0 ratingsRy's Git Tutorial Rating: 0 out of 5 stars0 ratingsTiny Python Projects: Learn coding and testing with puzzles and games Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5How Do I Do That In InDesign? Rating: 5 out of 5 stars5/5OneNote: The Ultimate Guide on How to Use Microsoft OneNote for Getting Things Done Rating: 1 out of 5 stars1/5iPhone Application Development For Dummies Rating: 4 out of 5 stars4/5Test-Driven iOS Development with Swift Rating: 5 out of 5 stars5/5Lua Game Development Cookbook Rating: 0 out of 5 stars0 ratingsiOS App Development For Dummies Rating: 0 out of 5 stars0 ratingsManaging Humans: Biting and Humorous Tales of a Software Engineering Manager Rating: 4 out of 5 stars4/5
Reviews for Android Studio 2 Essentials - Second Edition
0 ratings0 reviews
Book preview
Android Studio 2 Essentials - Second Edition - Belén Cruz Zapata
Table of Contents
Android Studio 2 Essentials Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Installing and Configuring Android Studio
Preparing for installation
Downloading Android Studio
Installing Android Studio
Running Android Studio for the first time
Configuring the Android SDK
Summary
2. Starting a Project
Creating a new project
Configuring the project
Selecting the form factors
Choosing the activity type
Customizing your activity
Summary
3. Navigating a Project
The project navigation panel
The project structure
The resources folder
The manifest file
Gradle
Project settings
Summary
4. Using the Code Editor
Customizing editor settings
General
Colors & Fonts
Code Style
File and Code Templates
Code Completion
Smart Type Completion
Postfix Completion
Code generation
Navigating code
Useful shortcuts
Summary
5. Creating User Interfaces
The graphical editor
The text-based editor
Creating a new layout
Adding components
Component's properties
Supporting multiple screens
Changing the UI theme
Handling events
Summary
6. Tools
Software Development Kit Manager
The AVD Manager
The Android emulator
Generating Javadoc
Tasks and contexts
Version control systems
Summary
7. Google Play Services
How Google Play services work
Available services
Adding Google Play services to Android Studio
Google Maps Android API
Google Places
Geo Data API
Place Detection API
Google Sign-In
Google+ Platform for Android
Google Play In-App Billing
Google Cloud Messaging
More sample apps
Summary
8. Debugging
Running and debugging
Console
Debugger
LogCat
Monitors
Instant run
Android Device Monitor
Threads
Method profiling
Heap
Allocation Tracker
Network Statistics
File Explorer
Emulator Control
System Information
Hierarchy View
Summary
9. Preparing for Release
Understanding an APK file
Build types
Steps prior to releasing your app
Generating a signed APK
Sign automatically in release mode
Running your app in release mode
APK Analyzer
Summary
A. Getting Help
Getting help from Android Studio
Android online documentation
Updates
Summary
Index
Android Studio 2 Essentials Second Edition
Android Studio 2 Essentials Second Edition
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2015
Second edition: June 2016
Production reference: 1170616
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78646-795-9
www.packtpub.com
Credits
Author
Belén Cruz Zapata
Reviewer
Antonio Hernández Niñirola
Commissioning Editor
Wilson D'souza
Acquisition Editor
Larissa Pinto
Content Development Editor
Sweta Basu
Technical Editor
Prajakta Mhatre
Copy Editor
Charlotte Carneiro
Project Coordinator
Bijal Patel
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
About the Author
Belén Cruz Zapata received her engineer's degree in computer science from the University of Murcia in Spain, specializing in software technologies, and intelligent and knowledge technologies. She earned an MSc in computer science and is now working on her PhD in the Software Engineering Research Group from the University of Murcia.
During the 2013/2014 academic year, Belén collaborated with the Université Mohammed V-Soussi, in Rabat, Morocco. Her research is focused on usability applied to mobile health (mHealth) applications.
Belén is currently working as a mobile developer for Android and iOS in the San Francisco Bay area. She is also the author of the book: Testing and Securing Android Studio Applications, Packt Publishing.
To follow her projects, you can visit her personal webpage at http://www.belencruz.com and you can follow her on Twitter: @belen_cz.
I would like to thank Packt Publishing for offering me the opportunity to write this book. I would particularly like to thank Larissa Pinto and Sweta Basu for their valuable help.
Each book represents a different period of my life, and this time, I would like to thank all my JCF-related friends here in San Francisco, for making it easier to live far from home. I would also like to thank my lifelong friends, my family, and my significant other, for being always with me.
About the Reviewer
Antonio Hernández Niñirola is a European PhD candidate in software engineering, which is the last step of the doctorate program. He did his BSc in computer science, and has a masters degree from the University of Murcia in Spain.
He has been in San Francisco since May 2015, working as a part of the Android Development Team at Yelp.
Antonio has collaborated with Packt Publishing as both author and reviewer several times. If you want to learn more advanced techniques on testing and security for Android, check out his book Testing and Securing Android Studio Applications. If you are new to Android development, check out these other books he has reviewed for Packt Publishing: Android Studio Application Development and Android Studio Essentials (first and second edition). If you would like to develop games for Android, check out Mastering Android Game Development.
For more information about him, visit his personal website (http://www.ninirola.es). Feel free to reach out on Twitter to @hdezninirola if you have any questions concerning Android or software engineering in general.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Preface
Mobile applications have had a huge increase in popularity in the last few years and interest is still growing among users. Mobile operating systems are available not only for smart phones, but tablets as well, therefore increasing the possible market share for these applications.
Android has characteristics that make it pleasant for developers such as open source and having a high level of community, driven development. Android has always been in competition with iOS (the Apple mobile system) in everything and with XCode, iOS presented itself as a more centralized development environment. The new Android Studio IDE makes this centralization finally available for Android developers and makes this tool indispensable for a good Android developer.
This book about Android Studio shows users how to develop and build Android applications with this new IDE. It is not only a getting started book, but also a guide for advanced developers on building their applications faster and more productively. This book will follow a tutorial approach from the basic features to the steps to build for release, including practical examples.
What this book covers
Chapter 1, Installing and Configuring Android Studio, describes the installation and basic configuration of Android Studio.
Chapter 2, Starting a Project, shows how to create a new project and the type of activities we can select.
Chapter 3, Navigating a Project, explores the basic structure of a project in Android Studio.
Chapter 4, Using the Code Editor, exposes the basic features of the code editor in order to get the best out of it.
Chapter 5, Creating User Interfaces, focuses on the creation of user interfaces, using both the graphical view and the text-based view.
Chapter 6, Tools, exposes some additional tools, such as the Android SDK tools, Javadoc, and the version control integration.
Chapter 7, Google Play Services, introduces the current existing Google Play Services and how to integrate them into a project in Android Studio.
Chapter 8, Debugging, shows in detail how to debug an application in Android Studio and the provided information when debugging.
Chapter 9, Preparing for Release, describes how to prepare your application for release.
Appendix, Getting Help, introduces how to get help using Android Studio and provides a list of online sites to learn more about the topics covered in this book.
What you need for this book
For this book, you need a computer with a Windows, Mac OS, or Linux system. You will also need to have Java installed in your system.
Who this book is for
This book is not only a getting started book, but also a guide for advanced developers who have not used Android Studio to build their Android apps before. This book is great for developers who want to learn the key features of Android Studio and for developers who want to create their first app. It's assumed that you are familiar with the object-oriented programming paradigm and the Java programming language. It is also recommended that you understand the main characteristics of the Android mobile system.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: The AppData directory is usually a hidden directory.
A block of code is set as follows:
package ${PACKAGE_NAME};
import android.app.Activity;
import android.os.Bundle;
#parse(File Header.java
)
public class ${NAME} extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
if (savedInstanceState != null
) {
}
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: You can also open it by clicking on the Project button on the left edge of the screen.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <feedback@packtpub.com>, and mention the book's title in the subject of your