Expert Android Studio. Dundar Onur
developer, whether an Android newbie or a seasoned Android developer who used to work on ADT, will find this book useful for developing his or her knowledge of the tools that are actually there to support his or her coding skills.
Quoting Alex Theedom, co-author of my previous book: “Every chapter that we wrote has this goal: Write content that we would like to read ourselves.” We followed the same goal with Onur and the result is the book you are holding in your hands.
We hope that you enjoy reading this book as much as we enjoyed writing it.
NOTE
Be sure to read our blog at http://www.devchronicles.com/2016/06/expert-android-studio-book-updates.html to see the changes announced at Google I/O 2016.
To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.
WARNING
Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the surrounding text.
NOTE
Notes, tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this.
As for styles in the text:
• We highlight new terms and important words when we introduce them.
• We show keyboard strokes like this: Ctrl+A.
• We show file names, URLs, and code within the text like so: persistence.properties.
• For code:
We use a monofont type for code examples.We use bold to emphasize code that is of particular importance in the current context.
As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All of the source code used in this book is available for download at www.wiley.com/go/expertandroid. Once at the site, simply click the Download Code link on the book's detail page to obtain all the source code for the book.
NOTE
Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978-1-119-08925-4.
Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.
We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or a faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration and at the same time you will be helping us provide even higher quality information.
To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page you can view all errata that have been submitted for this book and posted by Wrox editors. A complete book list including links to each book's errata is also available at www.wrox.com/misc-pages/booklist.shtml.
If you don't spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.
For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a Web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.
At http://p2p.wrox.com you will find a number of different forums that will help you not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:
1. Go to p2p.wrox.com and click the Register link.
2. Read the terms of use and click Agree.
3. Complete the required information to join as well as any optional information you wish to provide and click Submit.
4. You will receive an e-mail with information describing how to verify your account and complete the joining process.
NOTE
You can read messages in the forums without joining P2P but in order to post your own messages, you must join.
Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.
For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.
Chapter 1
Getting Started
WHAT'S IN THIS CHAPTER?
• System requirements for Android Studio
• Java installation instructions for Microsoft Windows, Mac OSX, and Linux
• Android Studio installation instructions for Microsoft Windows, Mac OSX, and Linux
In this chapter you get started with setting up your development environment so you can start Android development with Android Studio. To that end, this chapter covers the basic installation instructions for Android Studio and its system requirements.
Although the Android operating system is based on Linux, the Android SDK and tools are available for all major operating systems, so you can set up your development environment for the operating system you are working with. Throughout this book we use Mac OS as the main environment; however, we cover Linux and Windows setup as well.
To use Android Studio, your development system must meet the minimum system requirements. This section lists the minimum requirements for Windows, Mac OS X, and Linux.
Microsoft Windows
• Microsoft Windows 10/8/7/Vista/2003 (32 or 64 bit)
• 2GB RAM minimum, 4GB RAM recommended
• 400MB hard disk space
• At least 1GB for Android SDK, emulator system images, and caches
• 1280 × 800 minimum screen resolution
• Java Runtime Environment (JRE) 6 or higher
• Java Development Kit (JDK) 7
• Optional for accelerated emulator: Intel processor with support for Intel VT-x, Intel EM64T (Intel 64), and Execute Disable (XD) Bit functionality
Mac OS X
•