Preface Customer support wner of a Packt book,we have a number of things to Errata 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 roud be gratefu t you could r doing s youc rs from 15 ion and. us impr If you find ay rrata please rt th i the dotails of ing on t he dnteringe are verified to any list of existing errata under the Errata section of that title. To view the previously submitted errata. to httne.//w 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 ef the Please contact us at pirated mater copyrightpacktpub.com with a link to the suspected eagRmiRemmhepnpoaxtgourauhosandourabiyobhing you Questions If you have a problem with any aspect of this book,you can contact us at questionspacktpub.com,and we will do our best to address the problem. 【4]
Preface [ 4 ] Customer support 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. Errata 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 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 copyright@packtpub.com with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content. Questions If you have a problem with any aspect of this book, you can contact us at questions@packtpub.com, and we will do our best to address the problem
Installing and Configuring Android Studio The new and official Google IDE,Android Studio,with all its varied features,is ready to be explored.Would you like to make your own Android applications and 6Gog水yCyo的 This chapter will show you how to prepare your new Android Studio installation,and helψyou tak ngitonmcntrYelhegnkrTiPat3he anon an ding the see are de so that we have everything ready to create our first application. ment kit (SDK)properly These are the topics that we will cover in this chapter: Installing Android Studic 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 t variable nam
Installing and Configuring Android Studio The new and official Google IDE, Android Studio, with all its varied features, is ready to be explored. 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. Then we will see the welcome screen that prompts when running Android Studio for the first time, and accordingly, we will configure the Android software development kit (SDK) properly so that we have everything ready to create our first application. These are the topics that we will cover 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 SDK folder in your system. Check this environment variable to avoid issues during the installation of Android Studio
Installing and Configuring Android Studio Downloading Android Studio e can be downloaded from the Android developer tools the download button,as is shown in the next screenshot.This package is an EXE file for Windows systems,a DMG file for Mac OS X systems,and a TGZ file for Linux systems. Android Theofficial Android IDE Studio System Requirements Installing Android Studio In Windows,launch the EXE file.The default installation directory is \Users\your iyahadaalba1aoidanaoia-ecudioheaeoatatnerys ult installation directory is/Applications/Android\studio.app. In Linux systems,unzip the TGZfileand execute thecript located in the android-studio/bin/directory. If you have any problem in the installation process or in the following steps,you can get help on this and on other known issues by checking out Appendix,Getting Help. 【6]
Installing and Configuring Android Studio [ 6 ] 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 is an EXE file for Windows systems, a DMG file for Mac OS X systems, and 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 in the android-studio/bin/ directory. If you have any problem in the installation process or in the following steps, you can get help on this and on other known issues by checking out Appendix, Getting Help
Chapter1 Running Android Studio for the first time Execute android studio and wait until it loads completely.This may take a few minutes on 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 includes a section to open recent projects and the Quick Start section.The a project,an even perto vers oncontrolsystemnandnoQfada modifying the configuration options Welcome to Android Studio Recent Projects Quick Start New Project. G民mor Project No Project Open Yet Open Projec Ve Check ou om Version Comtrol Configure Docs and How-Tos Let's take a look at the various options available in the Quick Start section SmAaioiasudopmjtsoeitsawAadodpmt 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. 【71 www.allitebooks.com
Chapter 1 [ 7 ] Running Android Studio for the first time Execute Android Studio and wait until it loads completely. This may take a few minutes on 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 includes a section to open recent projects and the Quick Start section. The Quick Start section provides options to start a new project, open a project, import a project, and even perform more advanced actions such as checking out from a version control system and modifying the configuration options. Let's take a look at the various options available in the Quick Start section: • 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. • Import an Android code sample: This imports a project containing Google code samples from GitHub. • Check out project from Version Control: This creates a new project by importing existing sources from a version control system. www.allitebooks.com
Installing and Configuring Android Studio Import Non-Android Studio project:This creates a new project by importing existing sources from vour system. SDK Manager.This opens the Android SDKtol which will be explained in Chapter 6,Tools. Settings: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). Project Defaults:This opens the project defaults settings menu gh the Android Studio settings(by navigating to Configure Settings) e:This opens the project and Run Configurations:This opens the run and debug settings .Docs and How-Tos:This opens the help menu,which contains the following options: Read Help:This opens the Android Studio help,an online version Tips of the Day:This opens a dialog with the tip of the day 。 JetBrains TV:This opens a JetBrains website containing video tutorials ns a JetBrains website Configuring the Android SDK lthou Android Studio utomtic the latty o automatica lly insta Andro d SDK available ng you need orehand create your first application [81
Installing and Configuring Android Studio [ 8 ] • Import Non-Android Studio project: This creates a new project by importing existing sources from your system. • Configure: This opens the configuration menu. The configuration menu has the following options: ° SDK Manager: This opens the Android SDK tool, which will be explained in Chapter 6, Tools. ° Settings: 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). ° Project Defaults: This opens the project defaults settings menu. Settings: This opens the template project's settings. These settings are also reachable through the Android Studio settings (by navigating to Configure | Settings). Project Structure: This opens the project and platform settings. Run Configurations: This opens the run and debug settings. • Docs and How-Tos: This opens the help menu, which contains the following options: ° Read Help: 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 file containing the default keymap ° JetBrains TV: This opens a JetBrains website containing video tutorials ° Plugin Development: This opens a JetBrains website containing information for plugin developers Configuring the Android SDK The essential feature that needs to be configured correctly is the Android SDK. Although Android Studio automatically installs the latest Android SDK available, you should have everything you need beforehand to create your first application. It is important to check it and to learn how we can change it