Expert Android Studio. Dundar Onur
Чтение книги онлайн.
Читать онлайн книгу Expert Android Studio - Dundar Onur страница 6
Figure 1.18 Theme selection window for Linux
Figure 1.19 Android SDK configuration on Linux
When you first launch Android Studio, you will see the Complete Installation dialog box shown in Figure 1.20, which enables you to import settings from a previous installation. Because we made a clean installation for this example, we selected the last option in the dialog box. If you have a previous installation with customization you'd like to import, you can specify your previous installation path (see the first two options in Figure 1.20).
Figure 1.20 First launch of Android Studio
Welcome to Android Studio
Welcome to the world of Android development! When you finish installing Android Studio, you will finally reach the screen shown in Figure 1.21. Android Studio is ready to work with Android projects.
Figure 1.21 Welcome to Android Studio
In this book, the main focus is on using Android Studio for development at an advanced level. Therefore, the book covers Android SDK and tools installations together with Android Studio. If you would like to explore Android SDK and tools separately, you can get the standalone installation binaries for your choice of operating system.
Standalone installation will help you either work with an IDE other than Android Studio, or to use the tools alone. The binaries are available at http://developer.android.com/sdk/index.html at the bottom of the page.
As you did in this chapter, you can download the compatible binary for your operating system and follow similar installation steps to continue. After you download and extract the SDK, you can add its location to Android Studio using Settings⇨Appearance & Behavior⇨System Settings⇨Android SDK⇨Android SDK Location.
In this chapter, we wanted to make sure you have all the necessary tools to work on the examples in the following chapters. We started by providing the requirements for the basic computer system needed to install the required software.
We then covered the installation of Android Studio for Windows, Mac OS, and Linux. We continue with what is required to begin Android application development in Android Studio in Chapter 2.
Chapter 2
Android Studio Basics
WHAT'S IN THIS CHAPTER?
• How to create an Android Studio project
• Android project structure
• Creating and configuring virtual devices
• Building and running your project via ADB
• Migrating Android projects from Eclipse IDE
Welcome to Android Studio! Whether you are an Eclipse-based ADT veteran or a total newbie to Android development, you will enjoy Android Studio, which is based on IntelliJ IDEA and offers new tools, a UI editor, a whole new build system, memory/CPU analyzers, and many more new features and functionalities.
After long years of the Eclipse-based ADT plugin suite, Google announced (at Google I/O 2014) that Android Studio would be the official supported IDE for Android Development. Of course, you can still use ADT if you are coming from a strong Eclipse background; however, you will probably face problems that you may need to solve on your own.
As an Eclipse committer who has written code for several Eclipse projects, I preferred to stay with ADT for a long time. However, with the announcement that Android Studio is the official IDE, “resistance is futile.”
If you are new to Android development, it may even be easier to adapt to Android Studio because your previous Eclipse experience might not necessarily help you a lot on the IntelliJ platform.
Figure 2.1 shows the welcome screen of Android Studio, which is the first screen you will see when you launch Android Studio. From here, you can start a new project. In this chapter, you will work on a sample project, so let's open an existing project by importing the code.
Figure 2.1 Welcome to Android Studio window
1. Click the Import an Android code sample option in the list shown in Figure 2.1.
Numerous sample projects are hosted in GitHub. Because those projects are always up-to-date and new ones are added when a new API or functionality is introduced, it is a good idea to use them as a reference template for your own projects. Plus, all those samples are under the Apache software license, which makes them available to be used freely even in commercial products.
Because everyone loves selfies, in this example you build yet another selfie app.
2. Scroll down to Camera and select Camera2 Basic from the list shown in Figure 2.2.
Keep the Application name and Project location that appear on the Sample Setup screen (see Figure 2.3).
Figure 2.2 Import Sample – Browse Samples window
Figure 2.3 Import Sample – Sample Setup window
3. Click Finish.
Your project will be downloaded from GitHub, and the main IDE window, which is mostly empty, will appear.
Once you click Finish, Android Studio creates the project and switches to the main development layout. Before you figure out where to find your project files, let's take a look at Android SDK configuration in the following sidebar.
ANDROID SDK CONFIGURATION INSIDE ANDROID STUDIO
Android SDK can be downloaded and configured within Android Studio too with using Android Studio Preferences window. The following steps walk you through the configuration process.
1. Click the SDK Manager icon on the right side of the top toolbar, as shown in Figure 2.4.
The Android Studio Default Preferences window opens, as shown in Figure 2.5. The window focuses on the SDK integration option, listing the installed and available SDK versions as well as showing if any of them are eligible for an update.