How to install Android SDK and setup AVD Emulator without Android Studio
If you are trying to develop to Android, you probably will end up installing the Android Studio to get the Android SDK and the AVD Emulator working properly.
But if you are using another code editor, like Sublime Text or VSCode, installing the Android Studio will just mess up with your setup and consume your precious RAM for no good reason.
I had a hard time figuring out how to properly do this setup due the lack of documentation about it, so i hope this article helps you.
Recommended previous knowledge:
- SDK (Standard Development Kit); Read about on Wikipedia;
- AVD (Android Virtual Device); Read about on docs;
- CLI (Command Line Interface); Read about on Wikipedia;
- Android API levels; Read about on Vanderbilt University;
- How to open, navigate and execute files in your OS terminal;
- Know what are environmental variables;
Understanding the Android SDK
Basically, the Android SDK is a bunch of packages necessary to develop for Android.
These packages stays in subfolders of a folder called “sdk” (or “android-sdk” sometimes). You do not need to know how these packages really work, just what they do.
The picture below is my Android SDK folder, these are the basic packages you will need in order to get everything working properly.
Here is a brief explanation of each package:
- tools: This package is mainly used to manage the other packages and to create AVD’s;
- emulator: As the name suggest, this is the Android emulator;
- platform-tools: Some tools to communicate with Android devices when you plug then in your computer;
- patcher: This package is automatically downloaded by the SDK. I didn’t find what exactly this is for, so just leave it as it is;
The folders bellow contain sub-folders with the packages for each Android API level.
- platforms: The platform packages are required to compile your app for the specified API level.
- system-images: These are the android images used in the emulator.
- build-tools: These are necessary to build your Android apps
Installing the Android SDK
In order to install the SDK we will use the Command Line Tools. These are some quite simple CLI’s used to manage the Android SDK. You can read the documentation here for more details.
Step 1 — Download the tools package
First, you need to download the tools package. And with this package you can download the others.
- First, go to the Android Studio download page: https://developer.android.com/studio;
- Then click in “Download Options”;
- There you will find a table named “Command line tools only”;
- This table contain some zip files. Download the appropriate file for your system (Windows, Mac or Linux);
- Extract this zip and you will get a folder called tools: This is the tools package i explained earlier;
Create a folder anywhere you prefer to place your SDK. I recommend you to stick with one of these commonly used places:
on Windows:
- Globally: C:\Android\sdk or C:\android-sdk (this is not default, but i usually set my SDK here on Windows)
- One user only: C:\Users\<username>\AppData\Local\Android\sdk
on Linux
- Globally: /opt/android/sdk or /opt/android-sdk
- One user only: /home/<username>/.android/sdk
on MacOS
- Globally: /Library/Android/sdk
- One user only: /Users/<username>/Library/Android/sdk
And move the tools folder to this new sdk folder. Make sure you have admin access to this folder and any sub-folders inside it, or the tools package will fail to download new packages.
Note: You can also download a pre-build package for your SO (like the one available on Ubuntu repository). But i do not recommend you do to so, because they probably will not be updated and will be harder to manage, since it was automatically installed.
Step 2— You need Java 8!
The Android SDK packages require Java 8. If you do not have it, you need to download. If you are using a newer version, you have to downgrade to Java 8 or you will eventually get some errors, because it is not compatible.
If you do not have the Java 8 SDK, here is how you can install it:
- download it here: https://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.html;
On Ubuntu run these commands:
- # sudo apt-get update
- # sudo apt-get install openjdk-8-jdk
Sorry for MacOS users, i don’t know how to install it on this OS.
Step 3 — Download the essential packages
Now, download the platform-tools and the emulator packages, because they contain some CLI binary files you will need later. I decided to download these packages first in order to set all the necessary environment variables at once and make the rest of the process easier.
Open a terminal window (you need to use a terminal, not the file explorer), go to your sdk folder and navigate to the /tools/bin directory.
This folder contain the SDKManager binary: this is a CLI used to list the available packages in the Google’s repository and download, update or remove them from your SDK folder.
The bellow command will list all packages installed (the first items on the list) and all packages available to download:
To download the packages, simply copy the package names and pass it as a parameter to the SDKManager CLI using the terminal:
# ./sdkmanager platform-tools emulator
If you open your sdk folder you should see these packages folders there.
Step 4 — Set your environmental variables
You need to set the below environmental variables containing the path to our SDK, so any running program can find it in your pc:
ANDROID_SDK_ROOT = Path to your SDK folder
ANDROID_HOME = The same as ANDROID_SDK_ROOT. This variable is now deprecated, but i recommend setting it because some programs still using it to locate your sdk.
And add these folders to the PATH variable, making their binary files accessible from everywhere:
To add the environment variables on WIndows, just follow these steps:
- Open the “Control Panel”;
- Go to “System and Security” option in the side menu;
- In the window “System Properties” open the tab “Advanced”;
- Click in the button “Environment Variables” in the bottom of the page;
- In the “Environment Variables” window you will see two tables: “User Variables” and ”System Variables”.
- If you created your sdk folder for one user only, set the variables in the “User Variables” table;
- But, if you create your sdk folder globally, set the variables in the “System Variables” table instead;
On Linux, you can set your environment variables in many places. So i choose the ones I found the most appropriate:
-
If you created your sdk folder for one user only, set your environment variables in the file
Here is how i set these variables in my Ubuntu, using the file /etc/environment:
And sorry again, no MacOS instructions for this task.
You can find more about these environmental variables in the oficial docs here.
Now your SDK is ready! If you do not need to run the emulator there’s no need to follow the next steps.
Step 5 — Download the platform specific packages you want
You need more three packages: The platform, the system-image and the build-tools. You can download these packages for any Android version you prefer. In this article, i will download the packages for the API Level 28.
Use the “sdkmanager — list” command to find these packages and download them using the command “sdkmanager <package name>”.
Here’s an example:
Step 5 — Create a AVD device
Creating a AVD device is a simple task: run the AVDManager command (this is a binary file located in the tools/bin folder of your sdk) with the create avd option, a name for the new AVD and the image you want to use.
Here is a example:
# avdmanager create avd — name android28 — package “system-images;android-28;default;x86”
You will be asked if you want to alter some configurations. You can also modify these configurations later in the file config.ini, located in the avd folder (this folder usually is created in your user folder, under the android directory). The currently active configurations can be find in the file hardware-qemu.ini (this file just will be created after the emulator runs for the first time).
Step 6 — Run the Android Emulator
Now you just need to run the emulator command (remember that we added this package to the environmental variables?):
# emulator -avd <your_avd_name>
The emulator take some time to init for the first time. But if you done everything correctly you should see this screen:
Install Android Development Tools
Before You Begin
This 15-minute tutorial shows you how to install Android Studio, which includes the Android SDK, and create an Android Virtual Device (AVD) on which you install an Oracle JavaScript Extension Toolkit (Oracle JET) hybrid mobile application during a later tutorial. The time to complete doesn’t include processing time as a result of your activities.
Background
The Oracle JET command-line interface invokes the Android SDK that you install with Android Studio to build an Android application package (APK) file from the source files of your hybrid mobile application. This APK file is installed on an AVD to enable you to test the hybrid mobile application.
What Do You Need?
- A computer that meets the system requirements to install Android Studio. See System requirements at https://developer.android.com/studio/
Install and Set Up Android Studio
Depending on the operating system of your computer, the Android Studio installation wizard prompts you with dialogs where you choose between standard or custom install types. Choose the options recommended by the Android Studio installation wizard as these options include the components that you require to create and install a hybrid mobile application on an AVD. They also include an Android emulator and an emulator accelerator appropriate for your computer, be that Windows, Mac, or Linux.
- Go to the Download page for Android Studio on the Android Developer’s website at https://developer.android.com/studio/ and click DOWNLOAD ANDROID STUDIO.
- Review and accept the terms and conditions in the Download Android Studio dialog that appears and click DOWNLOAD ANDROID STUDIO FOR PLATFORM where PLATFORM refers to the operating system of your machine, such as Windows, Mac, or Linux.
- Go to the Install Android Studio guide at https://developer.android.com/studio/install and follow the instructions for your operating system to install and start Android Studio.
- If you run Android Studio behind a firewall or secure network, an Android Studio First Run dialog appears which displays a button (Setup Proxy) that you click to enter the proxy server settings for your environment. This allows Android Studio to complete the download of the components for a standard install.
- In the Welcome to Android Studio dialog, select Start a new Android Studio project, and then, in the Create New Project wizard, accept the default options to progress to the final screen in the wizard and click Finish.
This enables the Android Studio toolbar with the options that you need to create an AVD. It also downloads and configures the Gradle build tool that the Android SDK invokes to build the APK file when you complete the creation of your Oracle JET hybrid mobile application.
If you run Android Studio behind a firewall or secure network, a Proxy Settings dialog appears that enables you to configure proxy settings for the Gradle build tool that Android Studio downloads and configures. Provide the proxy settings for your environment to ensure that the Gradle build tool functions correctly.
Install an Android SDK Platform Package
- In the Android Studio toolbar, click the SDK Manager icon (
) to open the Android SDK page in the Default Settings dialog.
- In the SDK Platforms tab, select Android 8.0 (Oreo) with an API Level value of 26, and click Apply.
Description of the illustration sdkmgrdialog.png
- Click OK in the confirmation dialog that appears and accept the license agreement to proceed with the installation.
- Once the installation completes, click Finish and then click OK to close the Default Settings dialog.
Create and Start an Android Virtual Device
- In the Android Studio toolbar, click the AVD Manager icon ( ) and click Create Virtual Device in the Android Virtual Device Manager dialog that opens.
- In the Phone category of the Choose a device definition page of the Virtual Device Configuration dialog, select Nexus 5X and click Next.
- In the Recommended tab of the Select a system image page, click Download for the Oreo entry with an API Level of 26.
Description of the illustration downloadoreo.png The SDK Quickfix Installation wizard opens.
- Accept the license agreement to proceed with the download of the system image for Android 8.0 with API Level 26. Once the installation completes, click Finish and then click Next in the Select a system page.
- In the Verify Configuration page, review and accept the default settings such as the AVD Name value of Nexus 5X API 26, then click Finish.
- In the Android Virtual Device Manager dialog, click the Launch this AVD in the emulator icon (
) under the Actions column for the newly-created Nexus 5X API 26 AVD.
The Android emulator starts and loads the Nexus 5X API 26 AVD. A toolbar appears to the right of the AVD that provides UI controls to interact with the AVD.
Install the Java SE Development Kit 8
- Go to the Java SE Development Kit 8 Downloads page at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, accept the license agreement, and download the Java SE Development Kit installation file for your platform.
- Follow the JDK installation instructions for your platform at https://docs.oracle.com/javase/8/docs/technotes/guides/install/toc.html.
Create Environment Variables
To function correctly, the Apache Cordova command-line interface that the Oracle JET command-line interface communicates with requires that you configure environment variables. These environment variables reference the installation location of the Android SDK that is installed by Android Studio and the Java SE Development Kit 8.
- For Windows.
- Open the Environment Variables dialog from the System Properties dialog by navigating Control Panel > System and Security > System > Advanced System Settings > Environment Variables.
- Click New in the Environment Variables dialog and set the values of the variables to the location of the JDK and Android SDK locations, as shown in the following image. You can obtain the Android SDK location from the Android SDK page of the Default Settings dialog that you access in Android Studio by clicking Tools > SDK Manager.
Description of the illustration envvar.png
- For Mac and Linux-type systems, the settings depend upon your default shell. For example, on a Mac system using the Bash shell, add the following lines in
Getting Started with Android Studio
Before installing the Android SDK, you must agree to the following terms and conditions.
Terms and Conditions
1. Introduction
2. Accepting this License Agreement
3. SDK License from Google
4. Use of the SDK by You
5. Your Developer Credentials
6. Privacy and Information
7. Third Party Applications
8. Using Android APIs
9. Terminating this License Agreement
10. DISCLAIMER OF WARRANTIES
11. LIMITATION OF LIABILITY
12. Indemnification
13. Changes to the License Agreement
14. General Legal Terms
I have read and agree with the above terms and conditions
This download includes:
- Android Studio early access preview
- All the Android SDK Tools to design, test, debug, and profile your app
- The latest Android platform to compile your app
- The latest Android system image to run your app in the emulator
Android Studio is a new Android development environment based on IntelliJ IDEA. Similar to Eclipse with the ADT Plugin, Android Studio provides integrated Android developer tools for development and debugging. On top of the capabilities you expect from IntelliJ, Android Studio offers:
- Gradle-based build support.
- Android-specific refactoring and quick fixes.
- Lint tools to catch performance, usability, version compatibility and other problems.
- ProGuard and app-signing capabilities.
- Template-based wizards to create common Android designs and components.
- A rich layout editor that allows you to drag-and-drop UI components, preview layouts on multiple screen configurations, and much more.
- Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine as server-side components.
Caution: Android Studio is currently available as an early access preview. Several features are either incomplete or not yet implemented and you may encounter bugs. If you are not comfortable using an unfinished product, you may want to instead download (or continue to use) the ADT Bundle (Eclipse with the ADT Plugin).
DOWNLOAD FOR OTHER PLATFORMS
Platform | Package | Size | MD5 Checksum |
---|---|---|---|
Windows | android-studio-bundle-135.1078000-windows.exe | 519082997 bytes | ac69889210c4d02ee3ccc1c0f3c5cf3c |
android-studio-bundle-135.1078000-mac.dmg | 495989974 bytes | 8c7b1ef376b8ca206c99823d9e8fd54d | |
Linux | android-studio-bundle-135.1078000-linux.tgz | 520523870 bytes | 689238d5e632fd236b13f9c6d49f0cb4 |
Updating from older versions
If you already have Android Studio installed, in most cases, you can upgrade to the latest version by installing a patch. From within Android Studio, select Help > Check for updates (on Mac, Android Studio > Check for updates) to see whether an update is available.
If an update is not available, follow the installation instructions below and replace your existing installation.
Caution: Replacing your existing installation of Android Studio will remove any additional SDK packages you’ve installed, such as target platforms, system images, and sample apps. To preserve these, copy them from your current SDK directory under Android Studio to a temporary location before installing the update. Then move them back once the update is complete. If you fail to copy these packages, then you can instead download them again through the Android SDK Manager.
Installing Android Studio
Android Studio requires JDK 6 or greater (JRE alone is not sufficient). To check if you have JDK installed (and which version), open a terminal and type javac -version . If JDK is not available or the version is lower than 6, download JDK from here.
To install Android Studio:
- Download the Android Studio package from above.
- Install Android Studio and the SDK tools:
- Launch the downloaded EXE file, android-studio-bundle-<version>.exe .
- Follow the setup wizard to install Android Studio.
Known issue: On some Windows systems, the launcher script does not find where Java is installed. If you encounter this problem, you need to set an environment variable indicating the correct location.
Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21 .
- Open the downloaded DMG file, android-studio-bundle-<version>.dmg .
- Drag and drop Android Studio into the Applications folder.
Known issue: Depending on your security settings, when you attempt to open Android Studio, you might see a warning that says the package is damaged and should be moved to the trash. If this happens, go to System Preferences > Security & Privacy and under Allow applications downloaded from, select Anywhere. Then open Android Studio again.
- Unpack the downloaded Tar file, android-studio-bundle-<version>.tgz , into an appropriate location for your applications.
- To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh .
You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.
That’s it! You’re ready to start developing apps with Android Studio.
Note: On Windows and Mac, the individual tools and other SDK packages are saved within the Android Studio application directory. To access the tools directly, use a terminal to navigate into the application and locate the sdk/ directory. For example:
Mac: /Applications/Android\ Studio.app/sdk/
For a list of some known issues, see tools.android.com/knownissues.
Starting a Project
When you launch Android Studio for the first time, you’ll see a Welcome screen that offers several ways to get started:
-
To start building a new app, click New Project.
Note: If you previously developed your Android project with Eclipse, you should first use the new export feature in the ADT plugin to prepare your project with the new Gradle build system. For more information, read Migrating from Eclipse.
For additional help using Android Studio, read Tips and Tricks.
As you continue developing apps, you may need to install additional versions of Android for the emulator and other packages such as the Android Support Library. To install more packages, use the SDK Manager, which you can open from Android Studio by clicking SDK Manager in the toolbar.
Revisions
Android Studio v0.5.2 (May 2014)
- See tools.android.com for a full list of changes.
Android Studio v0.4.6 (March 2014)
Android SDK
Android SDK — это дополнительный набор инструментов Android Studio, которые помогают написать код, запустить тестирование и отладку, проверить работу приложения на различных версиях операционной системы и оценить результат в реальном времени. Также пакет позволяет пользователям получать информацию о состоянии операционной системы, читать логи и выявлять ошибки. Через SDK для Андроид можно восстанавливать программную оболочку и устанавливать сторонние прошивки.
Освойте профессию «Android-разработчик»
Что такое Android SDK и для чего он нужен
Набор состоит из пакетов, необходимых для создания приложений. Вот основные, которыми могут воспользоваться разработчики на Android.
Android SDK Platform Tools. В группу входят такие инструменты взаимодействия с Android, как Android Debugging Bridge (ADB), Fastboot, Systrace и другие. ADB помогает найти ошибки в работе приложений, установить APK на смартфон. Fastboot — активировать быструю загрузку для управления мобильным устройством с компьютера, перепрошить гаджет, настроить доступ, параметры работы операционной системы. Systrace — получить информацию о запущенных процессах, проследить за активностью и объемом данных, которые отправлены по сети.
Запускайте приложения и игры для Android
Android SDK Build Tools. Компоненты Android SDK используются для создания кода. Zipalign позволяет оптимизировать файл APK, AAPT2 — проанализировать, проиндексировать и скомпилировать ресурсы в двоичный формат под платформу Android, Аpksigner — подписать пакет APK с помощью закрытого ключа.
Эмулятор Android. Инструмент помогает протестировать приложения и опробовать функции последних версий Android.
Подробное описание Android SDK и необходимую документацию можно найти на официальном сайте в разделе User guide.
Логотип Android Studio
Установка доступна на устройствах с операционными системами Windows, Mac, Linux и Chrome OS. Для запуска персональный компьютер должен соответствовать минимальным системным требованиям.
Где скачать Android SDK
Пользователи могут самостоятельно выбрать ОС и загрузить решение на официальном сайте разработчика. При нажатии на кнопку Download Options откроется список доступных версий. Если Android Studio не нужна, можно скачать базовые инструменты командной строки Android (аналог пакета Android SDK Tools, эта программа устарела). Для просмотра, удаления пакетов и установки доступных версий Android SDK предназначен SDK Manager.
Официальный сайт Android Studio
Как установить Android Studio на Windows
Процесс инсталляции занимает 2–5 минут в зависимости от характеристик ПК. Для корректной установки необходимо:
- Запустить файл Android Studio Setup от имени администратора.
- Согласиться с предупреждением системы безопасности, нажав на кнопку «Запустить».
- Дождаться распаковки и инсталляции установочных файлов.
- Разрешить вносить новые сведения для этого компьютера.
- Нажать на кнопку Next и выбрать компоненты Android SDK Platforms Tools, которые будут установлены. Лучше не снимать галочки, так как лишний функционал можно отключить в программе после установки.
- Указать путь установки и начать процесс инсталляции.
После извлечения всех файлов на экране появится надпись Completed. Для завершения установки нужно нажать на кнопки Next и Finish.
Станьте Android-разработчиком — работайте в штате, на фрилансе или запускайте собственные приложения
Где скачать и как установить Java Development Kit
Для работы с Android SDK требуется загрузка Java Development Kit. Java Development Kit отвечает за графическое отображение исходного кода. Чтобы увидеть список версий Java, нужно перейти на официальный сайт Oracle. Для установки необходимо:
- Выбрать версию. Последние версии Java доступны только для 64-битных систем. Их можно загрузить либо в компрессированном архиве, либо в инсталляционном файле.
- Зарегистрироваться в системе Oracle. Если у пользователя есть учетная запись — пройти процедуру авторизации.
- Скачать Java Development Kit для Android на ПК.
- Выполнить все требования установочного файла, указав место хранения утилиты.
- После завершения установки закрыть программу и перезагрузить компьютер.
- Теперь можно приступать к настройке и работе с Android SDK.
Интерфейс и настройка
Начало работы с Android SDK
Чтобы произвести начальную настройку программного обеспечения, необходимо:
- Запустить установленный софт SDK от имени администратора. После запуска программы высветится приветственное окно, в котором можно быстро создать проект.
- Выбрать заголовок Create New Project и нажать на понравившийся шаблон (Activity). Можно работать с нуля или редактировать готовый проект. Activity отвечает за логику экрана приложения. Лучше установить либо No Activity, либо Empty Activity.
- Указать в появившемся окне настроек название проекта и пакета. Если в планах публикация в Google Play, во втором случае нужно подобрать уникальное наименование. В окне можно поменять директорию проекта, язык программирования (Java или Kotlin), указать минимальную поддерживаемую версию Android SDK. Чем она ниже, тем больше устройств будут поддерживать приложение.
Чтобы добавить дополнительные инструменты Android SDK, нужно:
1. В открывшемся окне перейти во вкладку Tools и выбрать SDK Manager. Вкладка Tools расположена в верхней части установленного приложения.
Установка компонентов Android SDK
2. После этого открыть вкладку SDK Tools. В ней представлена информация об установочных пакетах, можно скачать необходимые для работы.
Знакомство и базовая настройка Android Studio завершены.
Разработка приложения в среде Android SDK
Возможные ошибки при установке и запуске
Если устройство соответствует характеристикам, но программа выдает ошибку Skipping SDK Tools 11, были установлены старые компоненты Java, а затем добавлен софт SDK. Необходимо переустановить все компоненты, начиная с пакетов разработки от Java и заканчивая Android Studio. После удаления рекомендуется очистить остаточные файлы программой CCleaner (или аналогами).
Программа конфликтует с кириллицей, поэтому иногда возникает ошибка non-ASCII. Чтобы устранить ее, необходимо переименовать учетную запись.
Android SDK Tools — это функциональное программное обеспечение, помогающее разработчикам создавать оптимизированные приложения. Независимо от того, используется ли Java, Kotlin или C#, SDK позволяет запустить продукт и получить доступ к уникальным функциям операционной системы. Google активно поддерживает и продвигает открытое программирование, поэтому каждый желающий может попробовать себя в роли кодера для ОС Android.
Освойте программирование на Java и Kotlin, мобильную разработку и UX/UI, разработайте свое приложение для Android. Центр карьеры поможет с резюме и подготовкой к собеседованию. Программа подойдет для новичков