Appendix: Setup
Contents:
- What you should already KNOW
- What you will LEARN
- What you will DO
- App overview
- Task 1. Set up your environment
- Learn more
The practicals in this book assume that you are using the latest version of Android Studio, and some of the practicals require at least Android Studio 3.0. For example, the Performance chapters teach you how to use the Android Profiler tools.
This page summarizes how to set up the latest version of Android Studio.
If you need more help, see Install Android Studio and Run Hello World in the Android Developer Fundamentals course and the resources at the end of this page.
What you should already KNOW
You should be able to:
- Create and run an Android app using Android Studio.
What you will LEARN
- How to set up your environment for the Advanced Android Development practicals.
What you will DO
- Install Android Studio 3 or later.
- Update Android Studio, if necessary.
- Update the SDK for building and running the apps you create in the Advanced Android Development course.
- If necessary, set up your mobile device to run and debug Android apps from your computer.
App overview
You can use the finished WordListSQLInteractive app from the Android Developer Fundamentals course to test your setup, or you can use any other app that's not simplistic.
Task 1. Set up your environment
1.1 Get Android Studio 3 or later
What follows are the summary instructions for installing Android Studio 3, for each platform that supports Android Studio.
Note that you can keep two independent versions of Android Studio on your development machine, if you want to.
Windows:
- Download Android Studio for Windows.
- Unpack the zip file.
- Rename the resulting folder to something unique like "Android Studio 3."
- Move the folder to a permanent location, such as next to your existing Android Studio install in
C:\Program Files\Android\
. - Inside
C:\Program Files\Android\Android Studio 3\bin\
, launchstudio64.exe
(or if you're on a 32-bit machine, launchstudio.exe
). - To make the version available in your Start menu, right-click
studio64.exe
and click Pin to Start Menu.
Mac:
- Download Android Studio for Mac.
Unpack the zip file.
Note: If you download version 2.3 or lower, the app name does not include the version number. Rename the new version before moving it into your apps directory. Otherwise, you might override your existing version of Android Studio.
Drag the app file into your Applications folder.
- Launch the app.
Linux:
- Download Android Studio for Linux.
- Unpack the zip file.
- Rename the resulting folder to something unique like "android-studio-3".
- Move the folder to wherever you have your stable version, such as within
/usr/local/
for your user profile, or within/opt/
for shared users. - Open a terminal, navigate into
android-studio-3/bin/
, and executestudio.sh
. - To make the new version available in your list of apps, select Tools > Create Desktop Entry from the Android Studio menu bar.
1.2 Update Android Studio
- Open Android Studio.
- If you are not prompted to update, select Android Studio > Check for updates....
- Continue to check for updates, until you see a dialog saying that you have the latest version.
1.3 Build an app to verify your Android Studio installation
You probably need to install additional SDK downloads before your app builds.
Open Android Studio, then open an existing app of some complexity, such as WordListSQLInteractive.
When you build an app that you built with a previous version of Android Studio, you may get errors about components and libraries that are missing.
Click the links as prompted by the error messages, and install the needed components.
Update Gradle, if you're prompted to do so.
Follow the prompts until your app finishes building.
1.4 Run the app on a mobile device
On your mobile device, enable developer options, if they are not already enabled. To find these settings on the device, open Settings > Developer options.
On Android 4.2 and higher, the Developer options screen is hidden by default. To make the screen visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
In Developer options, enable USB Debugging. This is necessary for your development machine to see and access your mobile device.
- Connect the mobile device to your development computer with a USB data cable.
- In Android Studio, click Run.
- You may be prompted to install HAXM and emulator images. If you have been using several emulator images, this installation can take a while. Your largest update may be over 1 GB and will take some time to download even on a fast connection. You can postpone the system image downloads and run them later from the AVD manager.
- After installation, choose your device and run the app.
1.5 Run the app on an emulator
- If the app is running on your device, stop it.
Run the app again, choosing an emulator. Your emulator may update before it runs your app.
If you don't have an emulator, click Create Virtual Device in the Select Deployment Target dialog. Choose a phone and an existing system image, if you have one, because additional system images are large to download.
Make sure that the app runs correctly.
1.6 Create and run Hello World
To make sure that you're ready to work, create and run a Hello World app:
- Create a new project using the Basic Activity.
- Accept all the defaults.
- Run the app on any device or emulator.
Learn more
- Android Studio Release Notes
- Android Plugin for Gradle Release Notes
- Install Android Studio and Run Hello World practical from Android Developer Fundamentals
- Run Apps on a Hardware Device
- Android Studio Preview documentation, for information on how to get and install preview versions of Android Studio