24,99 €
A fast-paced guide to get you up and running with Android application development using Android Studio 2
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. You are recommended to have prior knowledge of the main characteristics of the Android mobile system to get the most out of this book.
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.
A comprehensive and practical guide that will give you the essential skills required to develop Android applications quickly using Android Studio. With the help of a real-world project, this book will show how to make Android Studio a part of your development process and optimize it.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 191
Veröffentlichungsjahr: 2016
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
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
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.
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.
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 <[email protected]> for more details.
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.
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.
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.
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.
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.
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:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
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."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
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 <[email protected]>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged into your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Android_Studio_2_Essentials_Second_Edition_Code. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/AndroidStudio2EssentialsSecondEdition_ColorImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.
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:
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.
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:
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.
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:
The welcome screen, in addition to the main actions, also contains a configuration menu and a help menu, as described in the following:
