Читать книгу Expert Android Studio - Dundar Onur - Страница 2
INTRODUCTION
ОглавлениеNO MATTER HOW GOOD YOU ARE AT WRITING CODE, without proper knowledge of Integrated Development Environments (IDEs), you will face many obstacles. This book covers Google's Android Studio, the official tool for developing Android applications. Each chapter focuses on a specific topic, progressing from the basics of how to use the IDE to advanced topics such as writing plugins to extend the capabilities of the IDE.
WHO THIS BOOK IS FOR
This book is for developers with any level of experience. Whether you are new to Android or a seasoned Android developer who used Eclipse-based ADT before, this book will bring you to a level where you can unleash your true development potential by making use of Android Studio's tools.
WHAT THIS BOOK COVERS
This book not only covers features of Android Studio essential for developing Android apps but also touches on topics related to the whole development cycle. The following are just a few examples of the topics covered that are basic to Android Studio or that extend its capabilities:
• Sharing and versioning your code with Git
• Managing your builds with Gradle
• Keeping your code maintainable and bug free with testing
• Controlling the whole build and test cycle with Continuous Integration
• Writing plugins for Android Studio to extend its capabilities and add desired custom features
• Using third-party tools with Android Studio to improve the development process
HOW THIS BOOK IS STRUCTURED
Each chapter focuses on a specific topic related to Android Studio or an accompanying tool by explaining why it is needed and how it is used or configured. Some chapters provide code samples to demonstrate the use case or provide an example for the topic.
• Chapter 1: Getting Started: Installing and setting up your development environment. Creating an emulator for running your projects.
• Chapter 2: Android Studio Basics: Beginning with Android Studio, creating a new project, building your project, and migrating projects to Android Studio.
• Chapter 3: Android Application Development with Android Studio: Structure of Android Studio projects. How to use assets, XML files and the Android Manifest. Creating and working with modules.
• Chapter 4: Android Studio In Depth: Deep dive into Android Studio, explaining menus, editors, views, and shortcuts. How to use live templates and refactoring. How to build your projects and sign apks.
• Chapter 5: Layouts with Android Studio: How to use layouts with Android Studio. Explanation of previews and tools for UI development. Managing external dependencies. How to use and organize assets.
• Chapter 6: Android Build System: How to use and configure Gradle effectively. Writing plugins for Gradle
• Chapter 7: Multi-Module Projects: Adding modules in your project. How to create and work with Phone/Tablet, Library, Wear, TV, Glass, Auto, and Cloud modules.
• Chapter 8: Debugging and Testing: Debugging Android code with ADB. Learn details of the Android Devices Monitor, Android virtual devices, Lint, and testing your code.
• Chapter 9: Using Source Control: GIT: How to share your project and enable version control by using Git.
• Chapter 10: Continuous Integration: Automating your builds, tests, and releases using continuous integration servers.
• Chapter 11: Using Android NDK with Android Studio: Installing and using Android NDK for building projects with C/C++ code.
• Chapter 12: Writing Your Own Plugins: Writing your own plugins to extend the capabilities of the IntelliJ platform. Interacting with UI, editor, and adding your actions.
• Chapter 13: Third-Party Tools: Other accompanying tools that can help and speed the development lifecycle.
WHAT YOU NEED TO USE THIS BOOK
Any modern computer with an operating system that is supported by Android SDK and Android Studio is sufficient to use Android Studio, build Android apps, and run the samples given in this book. You need to install appropriate Android SDK, Android Studio, and Java Virtual Machine (JVM) for your OS. Some chapters require additional tools or frameworks to be installed such as Android NDK. You can find more information on exact hardware requirements needed in Chapter 1.
WHY WE WROTE THIS BOOK
In November 2007, Google released a preview version of Android SDK to allow developers to start playing with the new mobile operating system. Roughly two years later, in October 2009, ADT (Android Developer Tools) a plugin set for Eclipse, was released to the public.
As a Google I/O 2009 attendee, I (Murat) was lucky enough to have an Android device and was probably one of the earliest developers to download and install the plugins to my Eclipse. As years passed, we both followed the same passion to download and try new stuff released with new ADT versions.
At the time, I was an Eclipse committer who knew how to write plugins, extend the IDE's capabilities, and introduce the behavior and functionality I needed. So with each release of ADT, I was more and more excited to see what had been done with the tools.
On May 2013, at Google I/O, roughly four years after our love-hate relationship with ADT started, Google announced Android Studio, which soon became the official, supported IDE for Android development. ADT was never perfect. but it was familiar. Like many other developers, we knew all the shortcuts, how things work, what to do when something was not working, workarounds, and how the projects were structured. More significantly, we were able to write our own plugins or inspect ADT plugins to see why something went wrong. However, with the release of Android Studio, suddenly we were all in a new platform that we knew very little about.
We resisted switching to Android Studio for a while, but finally gave it a try. Suddenly, Android, a platform we were long familiar with, was a stranger. The new project structure was very different because of the changes introduced by IntelliJ and Gradle. To adopt IntelliJ, we decided to follow IntelliJ shortcuts instead of using IntelliJ shortcut mapping for Eclipse shortcuts, which made the situation even worse. We were barely able to search for a file or piece of code, navigate through menus, right-click to create files, or even generate some basic getters and setters. We went from being experts with ADT to beginners with Android Studio.
We had finally had enough! We were experienced developers, but struggled with Android Studio and were not able to show our skills. So we started following IntelliJ talks, pinning the IntelliJ shortcut cheat sheet in our cubicles, reading IntelliJ plugin code, and forcing ourselves to use Android Studio in our daily work.
This book is the summary of the lessons we learned walking unaided on this difficult path. This book is what we needed for ourselves when we were switching from Eclipse-based ADT to IntelliJ-based Android Studio. This is why we believe any 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.
CONVENTIONS
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.
SOURCE CODE
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.
ERRATA
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.
P2P.WROX.COM
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.